fixes for SplitPanel

This commit is contained in:
rolux 2010-09-17 18:37:11 +02:00
parent 952be0a154
commit 36a747fe83

View file

@ -1485,26 +1485,37 @@ requires
ids: $.map(self.options.elements, function(v, i) { ids: $.map(self.options.elements, function(v, i) {
return v.options('id'); return v.options('id');
}), }),
length: self.options.resize.length, leftOrTop: self.options.edge == 'left' || self.options.edge == 'top',
startPos: 0, startPos: 0,
startSize: 0 startSize: 0
}); });
function drag(e) { function drag(e) {
var d = e[self.clientXY] - self.startPos, i; var d = e[self.clientXY] - self.startPos;
self.options.size = Ox.limit(self.startSize + d, self.options.resize[0], self.options.resize[self.length - 1]); self.options.size = Ox.limit(
Ox.print('sS', self.startSize, 'd', d, 's.o.s', self.options.size) self.startSize + d * (self.leftOrTop ? 1 : -1),
self.options.resize[0],
self.options.resize[self.options.resize.length - 1]
);
Ox.print('sS', self.startSize, 'd', d, 's.o.s', self.options.size, 'edge', self.options.edge, self.edges)
$.each(self.options.resize, function(i, v) { $.each(self.options.resize, function(i, v) {
if (self.options.size > v - 8 && self.options.size < v + 8) { if (self.options.size > v - 8 && self.options.size < v + 8) {
self.options.size = v; self.options.size = v;
return false; return false;
} }
}); });
that.css(self.edges[2], self.options.size + 'px'); that.css(self.edges[self.leftOrTop ? 2 : 3], self.options.size + 'px');
self.options.elements[0].css(self.dimensions[1], self.options.size + 'px'); if (self.leftOrTop) {
self.options.elements[1].css(self.edges[2], (self.options.size + 1) + 'px'); self.options.elements[0].css(self.dimensions[1], self.options.size + 'px');
Ox.Event.trigger(self.ids[0], 'resize', self.options.size); self.options.elements[1].css(self.edges[2], (self.options.size + 1) + 'px');
Ox.Event.trigger(self.ids[1], 'resize', self.options.elements[1][self.dimensions[1]]()); Ox.Event.trigger(self.ids[0], 'resize', self.options.size);
Ox.Event.trigger(self.ids[1], 'resize', self.options.elements[1][self.dimensions[1]]());
} else {
self.options.elements[1].css(self.dimensions[1], self.options.size + 'px');
self.options.elements[0].css(self.edges[3], (self.options.size + 1) + 'px');
Ox.Event.trigger(self.ids[1], 'resize', self.options.size);
Ox.Event.trigger(self.ids[0], 'resize', self.options.elements[0][self.dimensions[1]]());
}
} }
function dragStart(e) { function dragStart(e) {
@ -5933,7 +5944,6 @@ requires
orientation: 'vertical', orientation: 'vertical',
pageLength: 100, pageLength: 100,
request: function() {}, // (data, callback), without data returns {items, size etc.} request: function() {}, // (data, callback), without data returns {items, size etc.}
//rowLength: 1,
sort: [], sort: [],
type: 'text', type: 'text',
unique: '' unique: ''
@ -6205,7 +6215,9 @@ requires
} }
function getRowLength() { function getRowLength() {
return Math.floor((getWidth() - self.listMargin) / (self.options.itemWidth + self.itemMargin)); return self.options.orientation == 'both' ?
Math.floor((getWidth() - self.listMargin) /
(self.options.itemWidth + self.itemMargin)) : 1
} }
function getSelectedIds() { function getSelectedIds() {
@ -6593,7 +6605,7 @@ requires
pageHeight: self.options.orientation == 'horizontal' ? 0 : pageHeight: self.options.orientation == 'horizontal' ? 0 :
Math.ceil(self.pageLength * (self.options.itemHeight + self.itemMargin) / self.rowLength) Math.ceil(self.pageLength * (self.options.itemHeight + self.itemMargin) / self.rowLength)
}); });
Ox.print('list self', self); Ox.print('list self', self, self.listHeight);
that.$content.css({ that.$content.css({
height: self.listHeight + 'px' height: self.listHeight + 'px'
}); });
@ -8713,7 +8725,8 @@ requires
$.extend(self, { $.extend(self, {
dimensions: oxui.getDimensions(self.options.orientation), dimensions: oxui.getDimensions(self.options.orientation),
edges: oxui.getEdges(self.options.orientation), edges: oxui.getEdges(self.options.orientation),
length: self.options.elements.length length: self.options.elements.length,
$resizebars: []
}); });
that.$elements = []; that.$elements = [];
@ -8731,15 +8744,13 @@ requires
.css(self.edges[3], 0); .css(self.edges[3], 0);
}); });
setSizes();
$.each(self.options.elements, function(i, v) { $.each(self.options.elements, function(i, v) {
//that.append(element) //that.append(element)
//Ox.print('V: ', v, that.$elements[i]) //Ox.print('V: ', v, that.$elements[i])
that.$elements[i].appendTo(that.$element); // fixme: that.$content that.$elements[i].appendTo(that.$element); // fixme: that.$content
if (v.collapsible || v.resizable) { if (v.collapsible || v.resizable) {
Ox.print('v.size', v.size) Ox.print('v.size', v.size)
var $resizebar = new Ox.Resizebar({ self.$resizebars[i == 0 ? 0 : 1] = new Ox.Resizebar({
collapsible: v.collapsible, collapsible: v.collapsible,
edge: self.edges[i == 0 ? 0 : 1], edge: self.edges[i == 0 ? 0 : 1],
elements: i < 2 ? elements: i < 2 ?
@ -8751,12 +8762,13 @@ requires
resizable: v.resizable, resizable: v.resizable,
resize: v.resize, resize: v.resize,
size: v.size size: v.size
}) });
.css(self.edges[i == 0 ? 0 : 1], v.size); self.$resizebars[i == 0 ? 0 : 1][i == 0 ? 'insertAfter' : 'insertBefore'](that.$elements[i]);
$resizebar[i == 0 ? 'insertAfter' : 'insertBefore'](that.$elements[i]);
} }
}); });
setSizes();
function getPositionById(id) { function getPositionById(id) {
var position = -1; var position = -1;
$.each(self.options.elements, function(i, element) { $.each(self.options.elements, function(i, element) {
@ -8794,6 +8806,9 @@ requires
self.edges[0], (getSize(self.options.elements[0]) + getSize(self.options.elements[1])) + 'px' self.edges[0], (getSize(self.options.elements[0]) + getSize(self.options.elements[1])) + 'px'
); );
} }
if (v.collapsible || v.resizable) {
self.$resizebars[i == 0 ? 0 : 1].css(self.edges[i == 0 ? 0 : 1], v.size);
}
}); });
} }