From c7b07a9663ac1553fb10d8541b25274e522e07f7 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 7 Mar 2012 10:39:23 -0800 Subject: Fixed Collapsing and resizing window with panels Signed-off-by: Armen Kesablyan --- js/panels/PanelContainer.reel/PanelContainer.js | 35 ++++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index dd720bd3..8cc303dc 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -81,7 +81,7 @@ exports.PanelContainer = Montage.create(Component, { handleResize: { value: function(e) { - this._setPanelsSizes(null); + this._redrawPanels(null, true); } }, @@ -104,8 +104,6 @@ exports.PanelContainer = Montage.create(Component, { // switch panels this.panels[droppedIndex].element.parentNode.insertBefore(this.panels[draggedIndex].element, this.panels[droppedIndex].element); } - - this._setPanelsSizes(null); } }, @@ -133,7 +131,10 @@ exports.PanelContainer = Montage.create(Component, { setLocked = false; } - var childrensMinHeights = ((len - 1) * 26) + panelActivated.minHeight; + var childrensMinHeights = (len * 26); + if (panelActivated) { + childrensMinHeights+= panelActivated.minHeight -26; + } for(var i = 0; i < len; i++) { var obj = this['panel_'+i]; @@ -169,25 +170,27 @@ exports.PanelContainer = Montage.create(Component, { var unlockPanels = true; var afterPanel = false; var panelName = e.target.parentComponent.name; + + this.panels.forEach(function(obj) { + if(afterPanel) { + if(obj.flexible && obj.collapsed === false) { + unlockPanels = false; + } + } + if (obj.name === panelName) { + afterPanel = true; + } + }); + switch(e.target.identifier) { case "btnCollapse": this.currentPanelState[e.target.parentComponent.name].collapsed = e.target.parentComponent.collapsed; this.application.localStorage.setItem("panels", this.currentPanelState); - this._setPanelsSizes(e.target.parentComponent); + //this._setPanelsSizes(e.target.parentComponent); this._redrawPanels(e.target.parentComponent, unlockPanels); break; case "btnClose": - this.panelController.content.forEach(function(obj) { - if(afterPanel) { - if(obj.flexible) { - unlockPanels = false; - } - } - if (obj.name === panelName) { - afterPanel = true; - this.panelController.removeObjects(obj); - } - }); + //this.panelController.removeObjects(obj); this._redrawPanels(e.target.parentComponent, unlockPanels); break; } -- cgit v1.2.3