make toggle work in splitpanel after replacing elements

This commit is contained in:
rolux 2011-01-02 10:52:59 +00:00
parent a940bb0989
commit 489a6f5502

View file

@ -1430,9 +1430,6 @@ requires
clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX', clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX',
dimensions: oxui.getDimensions(self.options.orientation), // fixme: should orientation be the opposite orientation here? dimensions: oxui.getDimensions(self.options.orientation), // fixme: should orientation be the opposite orientation here?
edges: oxui.getEdges(self.options.orientation), edges: oxui.getEdges(self.options.orientation),
ids: $.map(self.options.elements, function(element) { // fixme: needed?
return element.options('id');
}),
leftOrTop: self.options.edge == 'left' || self.options.edge == 'top', leftOrTop: self.options.edge == 'left' || self.options.edge == 'top',
startPos: 0, startPos: 0,
startSize: 0 startSize: 0
@ -1490,7 +1487,7 @@ requires
function toggle() { function toggle() {
if (self.options.collapsible) { if (self.options.collapsible) {
self.options.parent.toggle(self.ids[self.leftOrTop ? 0 : 1]); self.options.parent.toggle(self.leftOrTop ? 0 : self.options.elements.length - 1);
self.options.collapsed = !self.options.collapsed; self.options.collapsed = !self.options.collapsed;
} }
/* /*
@ -9196,7 +9193,7 @@ requires
that.$elements[self.resizebarElements[i][1]] that.$elements[self.resizebarElements[i][1]]
] ]
}); });
}) });
Ox.print(self.options.elements[pos]) Ox.print(self.options.elements[pos])
return that; return that;
}; };
@ -9216,6 +9213,14 @@ requires
that.replace(i, element.element); that.replace(i, element.element);
}); });
self.options.elements = elements; self.options.elements = elements;
self.$resizebars.forEach(function($resizebar, i) {
$resizebar.options({
elements: [
that.$elements[self.resizebarElements[i][0]],
that.$elements[self.resizebarElements[i][1]]
]
});
});
return that; return that;
} }
@ -9236,6 +9241,7 @@ requires
}; };
that.toggle = function(id) { that.toggle = function(id) {
// one can pass pos instead of id
Ox.print('toggle', id); Ox.print('toggle', id);
/* /*
// something like this is needed to load in collapsed state // something like this is needed to load in collapsed state
@ -9248,7 +9254,8 @@ requires
animate = {}; animate = {};
Ox.print('s.o.e', self.options.edge); Ox.print('s.o.e', self.options.edge);
*/ */
var pos = getPositionById(id), Ox.print('!!!! element', self.options.elements[getPositionById(id)], getPositionById(id), id);
var pos = Ox.isNumber(id) ? id : getPositionById(id),
element = self.options.elements[pos], element = self.options.elements[pos],
value = parseInt(that.css(self.edges[pos == 0 ? 0 : 1])) + value = parseInt(that.css(self.edges[pos == 0 ? 0 : 1])) +
element.element[self.dimensions[0]]() * element.element[self.dimensions[0]]() *