From 99d50a7dc1403d1d918a8e4a6f7876c559d5e3a9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 21 Jun 2012 17:34:37 -0700 Subject: Reclaim negative padding when moving items back into positive direction. Note that we only do this on elementChange and not elementChanging since it is a potentially slow routine. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index fce73882..3552935d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -279,6 +279,10 @@ exports.Stage = Montage.create(Component, { _userPaddingLeft: { value: 0 }, _userPaddingTop: { value: 0 }, + // keep track of the elements that determine the minimum left and top scrollable amount + minLeftElement: { value: null }, + minTopElement: { value: null }, + userPaddingLeft: { get: function() { return this._userPaddingLeft; }, set: function(value) { -- cgit v1.2.3 From 3b5e824faf4b7fa685498b45477cb85e9eec31a1 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 25 Jun 2012 09:47:11 -0700 Subject: When reclaiming stage's negative scroll padding, we need to use the template's left and top padding as the minimum values when switching between documents. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 3552935d..590ff5c3 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -249,6 +249,10 @@ exports.Stage = Montage.create(Component, { this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; this.currentDocument.model.userContentLeft = this._userContentLeft; this.currentDocument.model.userContentTop = this._userContentTop; + this.currentDocument.model.templateLeft = this.templateLeft; + this.currentDocument.model.templateTop = this.templateTop; + this.currentDocument.model.minLeftElement = this.minLeftElement; + this.currentDocument.model.minTopElement = this.minTopElement; //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); @@ -279,6 +283,9 @@ exports.Stage = Montage.create(Component, { _userPaddingLeft: { value: 0 }, _userPaddingTop: { value: 0 }, + templateLeft: { value: 0 }, + templateTop: { value: 0 }, + // keep track of the elements that determine the minimum left and top scrollable amount minLeftElement: { value: null }, minTopElement: { value: null }, @@ -378,6 +385,10 @@ exports.Stage = Montage.create(Component, { this._userContentTop = this.currentDocument.model.userContentTop; this._scrollLeft = this.currentDocument.model.scrollLeft; this._scrollTop = this.currentDocument.model.scrollTop; + this.templateLeft = this.currentDocument.model.templateLeft; + this.templateTop = this.currentDocument.model.templateTop; + this.minLeftElement = this.currentDocument.model.minLeftElement; + this.minTopElement = this.currentDocument.model.minTopElement; } else { this._userPaddingLeft = 0; this._userPaddingTop = 0; @@ -387,6 +398,10 @@ exports.Stage = Montage.create(Component, { this._userContentTop = 0; this._scrollLeft = 0; this._scrollTop = 0; + this.templateLeft = 0; + this.templateTop = 0; + this.minLeftElement = null; + this.minTopElement = null; } // Recalculate the canvas sizes because of splitter resizing @@ -404,9 +419,11 @@ exports.Stage = Montage.create(Component, { var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); if(initialLeft > this.documentOffsetLeft) { this.userPaddingLeft = -initialLeft; + this.templateLeft = -initialLeft; } if(initialTop > this.documentOffsetTop) { this.userPaddingTop = -initialTop; + this.templateTop = -initialTop; } } -- cgit v1.2.3 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/stage/stage.reel/stage.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'js/stage/stage.reel/stage.js') 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