aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-25 14:38:58 -0700
committerValerio Virgillito2012-06-25 14:38:58 -0700
commitd2e88bb251efb29f13911942f1f91101715c727e (patch)
tree71ba3ccf7594ff8dd0f79997073f1d57a51fdeb5 /js/stage
parent4e5331c9967d4a24df56160188cc916a4051052b (diff)
parent3b5e824faf4b7fa685498b45477cb85e9eec31a1 (diff)
downloadninja-d2e88bb251efb29f13911942f1f91101715c727e.tar.gz
Merge pull request #326 from mqg734/ReclaimStagePadding
Reclaim negative padding when moving items back into positive direction.
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage.reel/stage.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index f4de3070..5e913c76 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -249,6 +249,10 @@ exports.Stage = Montage.create(Component, {
249 this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; 249 this.currentDocument.model.documentOffsetTop = this._documentOffsetTop;
250 this.currentDocument.model.userContentLeft = this._userContentLeft; 250 this.currentDocument.model.userContentLeft = this._userContentLeft;
251 this.currentDocument.model.userContentTop = this._userContentTop; 251 this.currentDocument.model.userContentTop = this._userContentTop;
252 this.currentDocument.model.templateLeft = this.templateLeft;
253 this.currentDocument.model.templateTop = this.templateTop;
254 this.currentDocument.model.minLeftElement = this.minLeftElement;
255 this.currentDocument.model.minTopElement = this.minTopElement;
252 256
253 //call configure false with the old document on the selected tool to tear down down any temp. stuff 257 //call configure false with the old document on the selected tool to tear down down any temp. stuff
254 this.application.ninja.toolsData.selectedToolInstance._configure(false); 258 this.application.ninja.toolsData.selectedToolInstance._configure(false);
@@ -279,6 +283,13 @@ exports.Stage = Montage.create(Component, {
279 _userPaddingLeft: { value: 0 }, 283 _userPaddingLeft: { value: 0 },
280 _userPaddingTop: { value: 0 }, 284 _userPaddingTop: { value: 0 },
281 285
286 templateLeft: { value: 0 },
287 templateTop: { value: 0 },
288
289 // keep track of the elements that determine the minimum left and top scrollable amount
290 minLeftElement: { value: null },
291 minTopElement: { value: null },
292
282 userPaddingLeft: { 293 userPaddingLeft: {
283 get: function() { return this._userPaddingLeft; }, 294 get: function() { return this._userPaddingLeft; },
284 set: function(value) { 295 set: function(value) {
@@ -374,6 +385,10 @@ exports.Stage = Montage.create(Component, {
374 this._userContentTop = this.currentDocument.model.userContentTop; 385 this._userContentTop = this.currentDocument.model.userContentTop;
375 this._scrollLeft = this.currentDocument.model.scrollLeft; 386 this._scrollLeft = this.currentDocument.model.scrollLeft;
376 this._scrollTop = this.currentDocument.model.scrollTop; 387 this._scrollTop = this.currentDocument.model.scrollTop;
388 this.templateLeft = this.currentDocument.model.templateLeft;
389 this.templateTop = this.currentDocument.model.templateTop;
390 this.minLeftElement = this.currentDocument.model.minLeftElement;
391 this.minTopElement = this.currentDocument.model.minTopElement;
377 } else { 392 } else {
378 this._userPaddingLeft = 0; 393 this._userPaddingLeft = 0;
379 this._userPaddingTop = 0; 394 this._userPaddingTop = 0;
@@ -383,6 +398,10 @@ exports.Stage = Montage.create(Component, {
383 this._userContentTop = 0; 398 this._userContentTop = 0;
384 this._scrollLeft = 0; 399 this._scrollLeft = 0;
385 this._scrollTop = 0; 400 this._scrollTop = 0;
401 this.templateLeft = 0;
402 this.templateTop = 0;
403 this.minLeftElement = null;
404 this.minTopElement = null;
386 } 405 }
387 406
388 // Recalculate the canvas sizes because of splitter resizing 407 // Recalculate the canvas sizes because of splitter resizing
@@ -400,9 +419,11 @@ exports.Stage = Montage.create(Component, {
400 var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); 419 var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2);
401 if(initialLeft > this.documentOffsetLeft) { 420 if(initialLeft > this.documentOffsetLeft) {
402 this.userPaddingLeft = -initialLeft; 421 this.userPaddingLeft = -initialLeft;
422 this.templateLeft = -initialLeft;
403 } 423 }
404 if(initialTop > this.documentOffsetTop) { 424 if(initialTop > this.documentOffsetTop) {
405 this.userPaddingTop = -initialTop; 425 this.userPaddingTop = -initialTop;
426 this.templateTop = -initialTop;
406 } 427 }
407 } 428 }
408 429