fixes for SplitPanel

This commit is contained in:
rolux 2010-09-17 18:37:11 +02:00
parent 391c0670d0
commit 75f2e1ef02

View File

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