aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-16 13:06:34 -0700
committerNivesh Rajbhandari2012-05-16 13:06:34 -0700
commit4f46850b376b2d428a3d9415b1dc69b36b875a2c (patch)
tree8ff2c827261e0203d2214e9f36bb939e19947871 /js/stage
parent23bf5db97fb24afdb14d02faac1136fc04137e96 (diff)
downloadninja-4f46850b376b2d428a3d9415b1dc69b36b875a2c.tar.gz
Automatically add scrollbars when moving content to negative space.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage.reel/stage.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 125155d8..05376527 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -187,6 +187,33 @@ 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 this.application.ninja.stylesController.setElementStyle(this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0],
199 "padding-left", -value + "px", true);
200 this.userContentLeft = this._documentOffsetLeft;
201 this.updatedStage = true;
202 }
203 },
204
205 userPaddingTop: {
206 get: function() { return this._userPaddingTop; },
207 set: function(value) {
208 this._userPaddingTop = value;
209 this._documentOffsetTop = -value;
210 this.application.ninja.stylesController.setElementStyle(this._documentRoot.ownerDocument.getElementsByTagName("HTML")[0],
211 "padding-top", -value + "px", true);
212 this.userContentTop = this._documentOffsetTop;
213 this.updatedStage = true;
214 }
215 },
216
190 willDraw: { 217 willDraw: {
191 value: function() { 218 value: function() {
192 if(this.resizeCanvases) { 219 if(this.resizeCanvases) {
@@ -490,8 +517,8 @@ exports.Stage = Montage.create(Component, {
490 this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; 517 this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft;
491 this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; 518 this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop;
492 519
493 this.userContentLeft = -this._scrollLeft; 520 this.userContentLeft = this._documentOffsetLeft - this._scrollLeft;
494 this.userContentTop = -this._scrollTop; 521 this.userContentTop = this._documentOffsetTop - this._scrollTop;
495 522
496 // TODO - scroll events are not dependable. We may need to use a timer to simulate 523 // TODO - scroll events are not dependable. We may need to use a timer to simulate
497 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values 524 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values