aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-15 14:50:02 -0700
committerValerio Virgillito2012-05-15 14:50:02 -0700
commitcdf00ba3e82c5064dd02ffa27f3069b4dd2e04c2 (patch)
tree222d7939f0ac4863b13fae288aa5c0a8da862749 /js
parent1d72a82a4c27a288e900eab99818222159ef8e23 (diff)
parentd8c7c8959f330c3a153aac65197cce54172275fc (diff)
downloadninja-cdf00ba3e82c5064dd02ffa27f3069b4dd2e04c2.tar.gz
Merge pull request #233 from mqg734/Dom-Architecture
Fixing scrollbar syncing, including pan tool, for banner templates.
Diffstat (limited to 'js')
-rwxr-xr-xjs/stage/stage.reel/stage.js17
-rwxr-xr-xjs/tools/PanTool.js15
2 files changed, 18 insertions, 14 deletions
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, {
464 this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; 464 this.userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder;
465 this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; 465 this.userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder;
466 } else { 466 } else {
467 this._scrollLeft = this.application.ninja.currentDocument.documentRoot.scrollLeft; 467 this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft;
468 this._scrollTop = this.application.ninja.currentDocument.documentRoot.scrollTop; 468 this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop;
469 469
470 this.userContentLeft = -this._scrollLeft; 470 this.userContentLeft = -this._scrollLeft;
471 this.userContentTop = -this._scrollTop; 471 this.userContentTop = -this._scrollTop;
@@ -512,11 +512,16 @@ exports.Stage = Montage.create(Component, {
512 */ 512 */
513 centerStage: { 513 centerStage: {
514 value: function() { 514 value: function() {
515 this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this._documentRoot.parentNode.offsetWidth)/2; 515 if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") {
516 this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this._documentRoot.parentNode.offsetHeight)/2; 516 this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this._documentRoot.parentNode.offsetWidth)/2;
517 this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this._documentRoot.parentNode.offsetHeight)/2;
517 518
518 this._scrollLeft = this._iframeContainer.scrollLeft; 519 this._scrollLeft = this._iframeContainer.scrollLeft;
519 this._scrollTop = this._iframeContainer.scrollTop; 520 this._scrollTop = this._iframeContainer.scrollTop;
521 } else {
522 this._scrollLeft = this._userContentLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = 0;
523 this._scrollTop = this._userContentTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = 0;
524 }
520 } 525 }
521 }, 526 },
522 527
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js
index 132ac0b1..5cfeec75 100755
--- a/js/tools/PanTool.js
+++ b/js/tools/PanTool.js
@@ -148,8 +148,7 @@ exports.PanTool = Montage.create(toolBase,
148 delta = 10*event.wheelDelta/120; 148 delta = 10*event.wheelDelta/120;
149 //console.log( "delta: " + delta ); 149 //console.log( "delta: " + delta );
150 150
151 this.application.ninja.currentDocument.documentRoot.scrollLeft += delta; 151 this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft += delta;
152// this.application.ninja.stage._scrollLeft += delta;
153 152
154 delta *= zoom; 153 delta *= zoom;
155 154
@@ -330,8 +329,8 @@ exports.PanTool = Montage.create(toolBase,
330 var limitX = false; 329 var limitX = false;
331 var limitY = false; 330 var limitY = false;
332 331
333 var oldLeft = this.application.ninja.currentDocument.documentRoot.scrollLeft, 332 var oldLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft,
334 oldTop = this.application.ninja.currentDocument.documentRoot.scrollTop, 333 oldTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop,
335 newLeft = oldLeft - deltaGPt[0], 334 newLeft = oldLeft - deltaGPt[0],
336 newTop = oldTop - deltaGPt[1]; 335 newTop = oldTop - deltaGPt[1];
337 if((newLeft < 0) || (newLeft > this._maxHorizontalScroll)) 336 if((newLeft < 0) || (newLeft > this._maxHorizontalScroll))
@@ -342,10 +341,10 @@ exports.PanTool = Montage.create(toolBase,
342 { 341 {
343 limitY = true; 342 limitY = true;
344 } 343 }
345 this.application.ninja.currentDocument.documentRoot.scrollLeft -= deltaGPt[0]; 344 this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft -= deltaGPt[0];
346 this.application.ninja.currentDocument.documentRoot.scrollTop -= deltaGPt[1]; 345 this.application.ninja.currentDocument.model.views.design.document.body.scrollTop -= deltaGPt[1];
347 deltaGPt[0] = oldLeft - this.application.ninja.currentDocument.documentRoot.scrollLeft; 346 deltaGPt[0] = oldLeft - this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft;
348 deltaGPt[1] = oldTop - this.application.ninja.currentDocument.documentRoot.scrollTop; 347 deltaGPt[1] = oldTop - this.application.ninja.currentDocument.model.views.design.document.body.scrollTop;
349 348
350 gPt[0] -= deltaGPt[0]; 349 gPt[0] -= deltaGPt[0];
351 gPt[1] -= deltaGPt[1]; 350 gPt[1] -= deltaGPt[1];