From 253b8803c71c88a6f87fb1caccd42fa081fc6eca Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 15 May 2012 14:17:41 -0700 Subject: Fixing scrollbar syncing, including pan tool, for banner templates. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 17 +++++++++++------ 1 file changed, 11 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 dc6444ff..e66c5b7b 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -464,8 +464,8 @@ exports.Stage = Montage.create(Component, { this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; } else { - this._scrollLeft = this.application.ninja.currentDocument.documentRoot.scrollLeft; - this._scrollTop = this.application.ninja.currentDocument.documentRoot.scrollTop; + this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; + this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; this.userContentLeft = -this._scrollLeft; this.userContentTop = -this._scrollTop; @@ -512,11 +512,16 @@ exports.Stage = Montage.create(Component, { */ centerStage: { value: function() { - this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this._documentRoot.parentNode.offsetWidth)/2; - this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this._documentRoot.parentNode.offsetHeight)/2; + if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { + this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this._documentRoot.parentNode.offsetWidth)/2; + this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this._documentRoot.parentNode.offsetHeight)/2; - this._scrollLeft = this._iframeContainer.scrollLeft; - this._scrollTop = this._iframeContainer.scrollTop; + this._scrollLeft = this._iframeContainer.scrollLeft; + this._scrollTop = this._iframeContainer.scrollTop; + } else { + this._scrollLeft = this._userContentLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = 0; + this._scrollTop = this._userContentTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = 0; + } } }, -- cgit v1.2.3