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