diff options
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 171c4f36..dc6444ff 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 |
@@ -540,13 +551,16 @@ exports.Stage = Montage.create(Component, { | |||
540 | */ | 551 | */ |
541 | getElement: { | 552 | getElement: { |
542 | value: function(position, selectable) { | 553 | value: function(position, selectable) { |
543 | var point, element; | 554 | var point, element, |
555 | docView = this.application.ninja.currentDocument.model.views.design; | ||
544 | 556 | ||
545 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); | 557 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset, position.pageY - docView.iframe.contentWindow.pageYOffset)); |
546 | element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); | 558 | element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop); |
547 | 559 | ||
560 | if(!element) debugger; | ||
548 | // workaround Chrome 3d bug | 561 | // workaround Chrome 3d bug |
549 | if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) { | 562 | if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) { |
563 | point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); | ||
550 | element = this.getElementUsingSnapping(point); | 564 | element = this.getElementUsingSnapping(point); |
551 | } | 565 | } |
552 | 566 | ||
@@ -877,7 +891,7 @@ exports.Stage = Montage.create(Component, { | |||
877 | //TODO - Maybe move to mediator. | 891 | //TODO - Maybe move to mediator. |
878 | var newVal = value/100.0; | 892 | var newVal = value/100.0; |
879 | if (newVal >= 1) | 893 | if (newVal >= 1) |
880 | this.application.ninja.currentDocument.iframe.style.zoom = value/100; | 894 | this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = value/100; |
881 | 895 | ||
882 | this.updatedStage = true; | 896 | this.updatedStage = true; |
883 | 897 | ||