aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-08 09:43:32 -0700
committerNivesh Rajbhandari2012-05-08 09:43:32 -0700
commit4baed156932f5875755532939a411953fa41c59d (patch)
treeb67d1de1196c1a940020afda49ba61b814d1e7d0 /js/stage
parent377c57c7debc98071593056be033978bd337c37e (diff)
downloadninja-4baed156932f5875755532939a411953fa41c59d.tar.gz
Stage should update scroll offsets when scrolled. Note that this is not always correct because we don't get a scroll end event. Updating Pan Tool to update scroll bars.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage.reel/stage.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 171c4f36..1f661513 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -118,6 +118,9 @@ exports.Stage = Montage.create(Component, {
118 _userContentTop: { value: 0 }, 118 _userContentTop: { value: 0 },
119 _userContentBorder: { value: 0 }, 119 _userContentBorder: { value: 0 },
120 120
121 _maxHorizontalScroll: { value: 0 },
122 _maxVerticalScroll: { value: 0 },
123
121 documentRoot: { 124 documentRoot: {
122 get: function () { return this._documentRoot; }, 125 get: function () { return this._documentRoot; },
123 set: function(value) { this._documentRoot = value; } 126 set: function(value) { this._documentRoot = value; }
@@ -264,7 +267,9 @@ exports.Stage = Montage.create(Component, {
264 this._userContentLeft = 0; 267 this._userContentLeft = 0;
265 this._userContentTop = 0; 268 this._userContentTop = 0;
266 269
267 //this.application.ninja.currentDocument._window.addEventListener("scroll", this, false); 270 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
271 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;
272 this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addEventListener("scroll", this, false);
268 } 273 }
269 274
270 275
@@ -464,6 +469,12 @@ exports.Stage = Montage.create(Component, {
464 469
465 this.userContentLeft = -this._scrollLeft; 470 this.userContentLeft = -this._scrollLeft;
466 this.userContentTop = -this._scrollTop; 471 this.userContentTop = -this._scrollTop;
472
473 // TODO - scroll events are not dependable. We may need to use a timer to simulate
474 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values
475 // on mouse down.
476// this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
477// this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;
467 } 478 }
468 479
469 // Need to clear the snap cache and set up the drag plane 480 // Need to clear the snap cache and set up the drag plane
@@ -543,7 +554,7 @@ exports.Stage = Montage.create(Component, {
543 var point, element; 554 var point, element;
544 555
545 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); 556 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY));
546 element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); 557 element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x + this.userContentLeft,point.y + this.userContentTop);
547 558
548 // workaround Chrome 3d bug 559 // workaround Chrome 3d bug
549 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) { 560 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) {