From 48bb94a72126e7be712b2c4ca9be2f03ecb65aea Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 25 Jun 2012 14:54:16 -0700 Subject: IKNinja-1688 - Creating a banner file after a code file causes body div to shift to the right and has different scroll bars. Signed-off-by: Nivesh Rajbhandari --- js/panels/Splitter.js | 8 ++++++-- js/stage/stage.reel/stage.js | 16 ++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index c6d46911..4f2a137e 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js @@ -156,7 +156,7 @@ exports.Splitter = Montage.create(Component, { } }, restore:{ - value: function() { + value: function(onSwitchFromCodeDocument) { //Get splitter initial value from SettingManager var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; if(storedData && this.element.getAttribute("data-montage-id") !== null) { @@ -172,7 +172,11 @@ exports.Splitter = Montage.create(Component, { this.panel.addEventListener("webkitTransitionEnd", this, false); } this.disabled = false; - this.needsDraw = true; + if(onSwitchFromCodeDocument) { + this.draw(); // When switching from code document, draw immediately so stage size is correct + } else { + this.needsDraw = true; + } } } } diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 5e913c76..319ffe87 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -19,6 +19,7 @@ exports.Stage = Montage.create(Component, { // TODO - Need to figure out how to remove this dependency // Needed by some tools that depend on selectionDrawn event to set up some logic drawNow: { value : false }, + switchedFromCodeDoc: { value : false }, // TO REVIEW zoomFactor: {value : 1 }, @@ -256,6 +257,8 @@ exports.Stage = Montage.create(Component, { //call configure false with the old document on the selected tool to tear down down any temp. stuff this.application.ninja.toolsData.selectedToolInstance._configure(false); + } else if(this.currentDocument && (this.currentDocument.currentView === "code")) { + this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar } this._currentDocument = value; @@ -266,7 +269,8 @@ exports.Stage = Montage.create(Component, { drawUtils._eltArray.length = 0; drawUtils._planesArray.length = 0; } else if(this._currentDocument.currentView === "design") { - this.restoreAllPanels(); + this.restoreAllPanels(this.switchedFromCodeDoc); + this.switchedFromCodeDoc = false; this.hideCanvas(false); this.showRulers(); @@ -1271,11 +1275,11 @@ exports.Stage = Montage.create(Component, { } }, restoreAllPanels:{ - value:function(){ - this.application.ninja.panelSplitter.restore(); - this.application.ninja.timelineSplitter.restore(); - this.application.ninja.toolsSplitter.restore(); - this.application.ninja.optionsSplitter.restore(); + value:function(onSwitchDocument){ + this.application.ninja.panelSplitter.restore(onSwitchDocument); + this.application.ninja.timelineSplitter.restore(onSwitchDocument); + this.application.ninja.toolsSplitter.restore(onSwitchDocument); + this.application.ninja.optionsSplitter.restore(onSwitchDocument); } }, -- cgit v1.2.3