diff options
author | Valerio Virgillito | 2012-05-08 11:10:57 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-08 11:10:57 -0700 |
commit | 13e123bdc73f1dae067978a2732469124cbd1282 (patch) | |
tree | b67d1de1196c1a940020afda49ba61b814d1e7d0 /js/stage | |
parent | 4d949f141247215b5f2a6ec0cfc7d2d31cf2bb1f (diff) | |
parent | 4baed156932f5875755532939a411953fa41c59d (diff) | |
download | ninja-13e123bdc73f1dae067978a2732469124cbd1282.tar.gz |
Merge pull request #200 from mqg734/Dom-Architecture
Scrolling support for stage.
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 15 |
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) { |