allow for replacement of all elements of a splitpanel
This commit is contained in:
parent
9d527099f8
commit
3a38c4209e
|
@ -1480,7 +1480,7 @@ requires
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragStart(e) {
|
function dragStart(e) {
|
||||||
if (!self.options.collapsed) {
|
if (self.options.resizable && !self.options.collapsed) {
|
||||||
self.startPos = e[self.clientXY];
|
self.startPos = e[self.clientXY];
|
||||||
self.startSize = self.options.size;
|
self.startSize = self.options.size;
|
||||||
Ox.print('startSize', self.startSize)
|
Ox.print('startSize', self.startSize)
|
||||||
|
@ -1494,9 +1494,11 @@ requires
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
var i = (self.options.edge == 'left' || self.options.edge == 'top') ? 0 : 1;
|
if (self.options.collapsible) {
|
||||||
self.options.parent.toggle(self.ids[i]);
|
var i = (self.options.edge == 'left' || self.options.edge == 'top') ? 0 : 1;
|
||||||
self.options.collapsed = !self.options.collapsed;
|
self.options.parent.toggle(self.ids[i]);
|
||||||
|
self.options.collapsed = !self.options.collapsed;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Ox.print('toggle');
|
Ox.print('toggle');
|
||||||
if (Ox.isUndefined(self.options.position)) {
|
if (Ox.isUndefined(self.options.position)) {
|
||||||
|
@ -8894,19 +8896,19 @@ requires
|
||||||
Ox.print('v.size', v.size)
|
Ox.print('v.size', v.size)
|
||||||
self.resizebarElements[index] = i < 2 ? [0, 1] : [1, 2];
|
self.resizebarElements[index] = i < 2 ? [0, 1] : [1, 2];
|
||||||
self.$resizebars[index] = new Ox.Resizebar({
|
self.$resizebars[index] = new Ox.Resizebar({
|
||||||
collapsible: v.collapsible,
|
collapsible: v.collapsible,
|
||||||
edge: self.edges[index],
|
edge: self.edges[index],
|
||||||
elements: [
|
elements: [
|
||||||
that.$elements[self.resizebarElements[index][0]],
|
that.$elements[self.resizebarElements[index][0]],
|
||||||
that.$elements[self.resizebarElements[index][1]]
|
that.$elements[self.resizebarElements[index][1]]
|
||||||
],
|
],
|
||||||
id: v.element.options('id'),
|
id: v.element.options('id'),
|
||||||
orientation: self.options.orientation == 'horizontal' ? 'vertical' : 'horizontal',
|
orientation: self.options.orientation == 'horizontal' ? 'vertical' : 'horizontal',
|
||||||
parent: that, // fixme: that.$content
|
parent: that, // fixme: that.$content
|
||||||
resizable: v.resizable,
|
resizable: v.resizable,
|
||||||
resize: v.resize,
|
resize: v.resize,
|
||||||
size: v.size
|
size: v.size
|
||||||
});
|
});
|
||||||
self.$resizebars[index][i == 0 ? 'insertAfter' : 'insertBefore'](that.$elements[i]);
|
self.$resizebars[index][i == 0 ? 'insertAfter' : 'insertBefore'](that.$elements[i]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -8970,6 +8972,7 @@ requires
|
||||||
that.replace = function(id, element) {
|
that.replace = function(id, element) {
|
||||||
// one can pass pos instead of id
|
// one can pass pos instead of id
|
||||||
var pos = Ox.isNumber(id) ? id : getPositionById(id);
|
var pos = Ox.isNumber(id) ? id : getPositionById(id);
|
||||||
|
Ox.print('replace', pos, element);
|
||||||
Ox.print('element', self.options.elements[pos].element, element)
|
Ox.print('element', self.options.elements[pos].element, element)
|
||||||
self.options.elements[pos].element.replaceWith(element.$element.$element || element.$element);
|
self.options.elements[pos].element.replaceWith(element.$element.$element || element.$element);
|
||||||
self.options.elements[pos].element = element;
|
self.options.elements[pos].element = element;
|
||||||
|
@ -8988,15 +8991,33 @@ requires
|
||||||
Ox.print(self.options.elements[pos])
|
Ox.print(self.options.elements[pos])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.replaceElements = function(elements) {
|
||||||
|
elements.forEach(function(element, i) {
|
||||||
|
if (Ox.isNumber(element.size)) {
|
||||||
|
that.size(i, element.size);
|
||||||
|
if (element.collapsible || element.resizable) {
|
||||||
|
self.$resizebars[i == 0 ? 0 : 1].options({
|
||||||
|
collapsible: element.collapsible,
|
||||||
|
resizable: element.resizable,
|
||||||
|
size: element.size
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that.replace(i, element.element);
|
||||||
|
});
|
||||||
|
self.options.elements = elements;
|
||||||
|
}
|
||||||
|
|
||||||
that.size = function(id, size) {
|
that.size = function(id, size) {
|
||||||
// one can pass pos instead of id
|
// one can pass pos instead of id
|
||||||
var pos = Ox.isNumber(id) ? id : getPositionById(id);
|
var pos = Ox.isNumber(id) ? id : getPositionById(id),
|
||||||
|
element = self.options.elements[pos];
|
||||||
Ox.print('pos', pos, 'size', size);
|
Ox.print('pos', pos, 'size', size);
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
Ox.print('size', self.options.elements[pos].element[self.dimensions[0]](), !that.isCollapsed(pos))
|
Ox.print('size', element.element[self.dimensions[0]](), !that.isCollapsed(pos))
|
||||||
return self.options.elements[pos].element[self.dimensions[0]]() * !that.isCollapsed(pos);
|
return element.element[self.dimensions[0]]() * !that.isCollapsed(pos);
|
||||||
} else {
|
} else {
|
||||||
self.options.elements[pos].size = size;
|
element.size = size;
|
||||||
setSizes();
|
setSizes();
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user