From e4e8a810e1fe6e18c06c21cd5fe8bfd6dd4f116a Mon Sep 17 00:00:00 2001 From: Lorefnon Date: Thu, 1 Nov 2012 00:35:09 +0530 Subject: [PATCH] Fix issue#63 --- components/editor/init.js | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/components/editor/init.js b/components/editor/init.js index 6c00984..436f207 100755 --- a/components/editor/init.js +++ b/components/editor/init.js @@ -49,25 +49,25 @@ _this.splitProp = w1 / _this.root.width(); _this.childElements[0] .width(w1) - .trigger('h-resize'); + .trigger('h-resize', [true, true]); _this.childElements[1] .width(w2) .css('left', w1 + separatorWidth + 'px') - .trigger('h-resize'); + .trigger('h-resize', [true, true]); _this.splitProp = ui.position.left / _this.root.width(); } else { var h1, h2; - h1 = ui.position.top - separatorWidth/2; + h1 = ui.position.top - separatorWidth/2; h2 = _this.root.width() - ui.position.top - separatorWidth/2; _this.splitProp = h1 / _this.root.height(); _this.childElements[0] .height(h1) - .trigger('v-resize'); + .trigger('v-resize', [true, true]); _this.childElements[1] .height(h2) .css('top', h1 + separatorWidth + 'px') - .trigger('v-resize'); + .trigger('v-resize', [true, true]); } } }); @@ -84,7 +84,7 @@ .width(root.width()); } - this.root.on('h-resize', function(e){ + this.root.on('h-resize', function(e, percolateUp, percolateDown){ e.stopPropagation(); if (_this.splitType === 'horizontal') { var w1, w2; @@ -106,14 +106,21 @@ .width(w); _this.splitter.width(w); } + if (percolateUp) { + _this.root.parent('.editor-wrapper') + .trigger('h-resize', [true ,false]); + } + if (! percolateDown) return; if (_this.childContainers[0]) { - _this.childContainers[0].root.trigger('h-resize'); + _this.childContainers[0].root + .trigger('h-resize', [false, true]); } else if (_this.childContainers[1]) { - _this.childContainers[1].root.trigger('h-resize'); + _this.childContainers[1].root + .trigger('h-resize', [false, true]); } }); - this.root.on('v-resize', function(e){ + this.root.on('v-resize', function(e, percolateUp, percolateDown){ e.stopPropagation(); if (_this.splitType === 'horizontal') { var h = _this.root.height(); @@ -134,16 +141,23 @@ .css('top', h1+separatorWidth); _this.splitter.css('top', h1); } + if (percolateUp) { + _this.root.parent('.editor-wrapper') + .trigger('v-resize', [true ,false]); + } + if (! percolateDown) return; if (_this.childContainers[0]) { - _this.childContainers[0].root.trigger('v-resize'); + _this.childContainers[0].root + .trigger('v-resize', [false, true]); } else if (_this.childContainers[1]) { - _this.childContainers[1].root.trigger('v-resize'); + _this.childContainers[1].root + .trigger('v-resize', [false, true]); } }); this.root - .trigger('h-resize') - .trigger('v-resize'); + .trigger('h-resize', [false, false]) + .trigger('v-resize', [false, false]); } SplitContainer.prototype = {