aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage.reel/stage.js41
1 files changed, 36 insertions, 5 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 93270561..cac99326 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -187,6 +187,37 @@ exports.Stage = Montage.create(Component, {
187 enumerable : false 187 enumerable : false
188 }, 188 },
189 189
190 _userPaddingLeft: { value: 0 },
191 _userPaddingTop: { value: 0 },
192
193 userPaddingLeft: {
194 get: function() { return this._userPaddingLeft; },
195 set: function(value) {
196 this._userPaddingLeft = value;
197 this._documentOffsetLeft = -value;
198 if(!this._documentRoot) {
199 this._documentRoot = this.application.ninja.currentDocument.documentRoot;
200 }
201 this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px";
202 this.userContentLeft = this._documentOffsetLeft;
203 this.updatedStage = true;
204 }
205 },
206
207 userPaddingTop: {
208 get: function() { return this._userPaddingTop; },
209 set: function(value) {
210 this._userPaddingTop = value;
211 this._documentOffsetTop = -value;
212 if(!this._documentRoot) {
213 this._documentRoot = this.application.ninja.currentDocument.documentRoot;
214 }
215 this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px";
216 this.userContentTop = this._documentOffsetTop;
217 this.updatedStage = true;
218 }
219 },
220
190 willDraw: { 221 willDraw: {
191 value: function() { 222 value: function() {
192 if(this.resizeCanvases) { 223 if(this.resizeCanvases) {
@@ -287,8 +318,8 @@ exports.Stage = Montage.create(Component, {
287 318
288 this._scrollLeft = 0; 319 this._scrollLeft = 0;
289 this._scrollTop = 0; 320 this._scrollTop = 0;
290 this._userContentLeft = 0; 321 this._userContentLeft = this._documentOffsetLeft;
291 this._userContentTop = 0; 322 this._userContentTop = this._documentOffsetTop;
292 323
293 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11; 324 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
294 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11; 325 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;
@@ -489,8 +520,8 @@ exports.Stage = Montage.create(Component, {
489 this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; 520 this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft;
490 this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; 521 this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop;
491 522
492 this.userContentLeft = -this._scrollLeft; 523 this.userContentLeft = this._documentOffsetLeft - this._scrollLeft;
493 this.userContentTop = -this._scrollTop; 524 this.userContentTop = this._documentOffsetTop - this._scrollTop;
494 525
495 // TODO - scroll events are not dependable. We may need to use a timer to simulate 526 // TODO - scroll events are not dependable. We may need to use a timer to simulate
496 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values 527 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values
@@ -581,7 +612,7 @@ exports.Stage = Montage.create(Component, {
581 var point, element, 612 var point, element,
582 docView = this.application.ninja.currentDocument.model.views.design; 613 docView = this.application.ninja.currentDocument.model.views.design;
583 614
584 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset, position.pageY - docView.iframe.contentWindow.pageYOffset)); 615 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset + this.documentOffsetLeft, position.pageY - docView.iframe.contentWindow.pageYOffset + this.documentOffsetTop));
585 element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop); 616 element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop);
586 617
587 if(!element) debugger; 618 if(!element) debugger;