splitpanel: make resize work after replace

This commit is contained in:
rolux 2010-12-23 01:04:47 +00:00
parent 11cc787d84
commit b3567cb503

View file

@ -1468,11 +1468,13 @@ requires
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]]());
self.options.parent.updateSize(self.ids[0], self.options.size);
} 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]]());
Ox.Event.trigger(self.ids[1], 'resize', self.options.size);
self.options.parent.updateSize(self.ids[1], self.options.size);
}
}
}
@ -8864,6 +8866,7 @@ requires
dimensions: oxui.getDimensions(self.options.orientation),
edges: oxui.getEdges(self.options.orientation),
length: self.options.elements.length,
resizebarElements: [],
$resizebars: []
});
@ -8885,15 +8888,18 @@ requires
$.each(self.options.elements, function(i, v) {
//that.append(element)
//Ox.print('V: ', v, that.$elements[i])
var index = i == 0 ? 0 : 1;
that.$elements[i].appendTo(that.$element); // fixme: that.$content
if (v.collapsible || v.resizable) {
Ox.print('v.size', v.size)
self.$resizebars[i == 0 ? 0 : 1] = new Ox.Resizebar({
self.resizebarElements[index] = i < 2 ? [0, 1] : [1, 2];
self.$resizebars[index] = new Ox.Resizebar({
collapsible: v.collapsible,
edge: self.edges[i == 0 ? 0 : 1],
elements: i < 2 ?
[that.$elements[0], that.$elements[1]] :
[that.$elements[1], that.$elements[2]],
edge: self.edges[index],
elements: [
that.$elements[self.resizebarElements[index][0]],
that.$elements[self.resizebarElements[index][1]]
],
id: v.element.options('id'),
orientation: self.options.orientation == 'horizontal' ? 'vertical' : 'horizontal',
parent: that, // fixme: that.$content
@ -8901,7 +8907,7 @@ requires
resize: v.resize,
size: v.size
});
self.$resizebars[i == 0 ? 0 : 1][i == 0 ? 'insertAfter' : 'insertBefore'](that.$elements[i]);
self.$resizebars[index][i == 0 ? 'insertAfter' : 'insertBefore'](that.$elements[i]);
}
});
@ -8971,6 +8977,14 @@ requires
.css(self.edges[2], 0)
.css(self.edges[3], 0);
setSizes();
self.$resizebars.forEach(function($resizebar, i) {
$resizebar.options({
elements: [
that.$elements[self.resizebarElements[i][0]],
that.$elements[self.resizebarElements[i][1]]
]
});
})
Ox.print(self.options.elements[pos])
};
@ -9020,6 +9034,13 @@ requires
});
};
that.updateSize = function(id, size) {
// this is called from resizebar
// one can pass pos instead of id
var pos = Ox.isNumber(id) ? id : getPositionById(id);
self.options.elements[pos].size = size;
}
return that;
};