diff options
author | Valerio Virgillito | 2012-04-09 16:47:56 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-09 16:47:56 -0700 |
commit | 48d4dd0f0570f4ac3556f228846ed0fd98a674e5 (patch) | |
tree | 9fb2e8a02f5d68eb72048c5d11f2f39e77daf9d4 /js/tools | |
parent | 4900f2e6e346df18b1b5a2ac89da5019644ac98a (diff) | |
download | ninja-48d4dd0f0570f4ac3556f228846ed0fd98a674e5.tar.gz |
setProperties to the montage undo/redo
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/tools')
-rwxr-xr-x | js/tools/SelectionTool.js | 57 |
1 files changed, 14 insertions, 43 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 94cc6b83..6dec781b 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js | |||
@@ -372,46 +372,21 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
372 | } | 372 | } |
373 | } | 373 | } |
374 | } | 374 | } |
375 | if(addToUndoStack) | 375 | |
376 | { | 376 | if(addToUndoStack) { |
377 | if(!this._use3DMode) | 377 | if(!this._use3DMode) { |
378 | { | ||
379 | // if we have a delta, that means the transform handles were used and | 378 | // if we have a delta, that means the transform handles were used and |
380 | // we should update the width and height too. Otherwise, just update left and top. | 379 | // we should update the width and height too. Otherwise, just update left and top. |
381 | if(this._delta) | 380 | if(this._delta) { |
382 | { | 381 | ElementsMediator.setProperties(this.application.ninja.selectedElements, {"left": newLeft, "top": newTop, "width": newWidth, "height": newHeight }, |
383 | ElementsMediator.setProperties(this.application.ninja.selectedElements, | 382 | { "left" : previousLeft, "top" : previousTop, "width": previousWidth, "height": previousHeight}, "Change", "selectionTool"); |
384 | { "left": newLeft, "top": newTop, "width": newWidth, "height": newHeight }, | 383 | } else { |
385 | "Change", | 384 | ElementsMediator.setProperties(this.application.ninja.selectedElements, {"left": newLeft, "top": newTop }, {"left": previousLeft, "top": previousTop}, "Change", "selectionTool"); |
386 | "selectionTool", | ||
387 | { "left" : previousLeft, "top" : previousTop, "width": previousWidth, "height": previousHeight} | ||
388 | ); | ||
389 | } | ||
390 | else | ||
391 | { | ||
392 | ElementsMediator.setProperties(this.application.ninja.selectedElements, | ||
393 | { "left": newLeft, "top": newTop }, | ||
394 | "Change", | ||
395 | "selectionTool", | ||
396 | { "left" : previousLeft, "top" : previousTop } | ||
397 | ); | ||
398 | } | 385 | } |
399 | } | 386 | } else { |
400 | else | ||
401 | { | ||
402 | // TODO - We don't support transform handles in 3d space for now | 387 | // TODO - We don't support transform handles in 3d space for now |
403 | ElementsMediator.setProperties(this.application.ninja.selectedElements, | 388 | ElementsMediator.setProperties(this.application.ninja.selectedElements, {"width": newWidth, "height": newHeight }, {"width": previousWidth, "height": previousHeight}, "Change", "selectionTool"); |
404 | { "width": newWidth, "height": newHeight }, | 389 | ElementsMediator.set3DProperties(this.application.ninja.selectedElements, newStyles, "Change", "translateTool", previousStyles); |
405 | "Change", | ||
406 | "selectionTool", | ||
407 | { "width": previousWidth, "height": previousHeight} | ||
408 | ); | ||
409 | ElementsMediator.set3DProperties(this.application.ninja.selectedElements, | ||
410 | newStyles, | ||
411 | "Change", | ||
412 | "translateTool", | ||
413 | previousStyles | ||
414 | ); | ||
415 | } | 390 | } |
416 | } | 391 | } |
417 | // Save previous value for undo/redo | 392 | // Save previous value for undo/redo |
@@ -471,13 +446,9 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
471 | } | 446 | } |
472 | } | 447 | } |
473 | 448 | ||
474 | if(newLeft.length) | 449 | if(newLeft.length) { |
475 | { | 450 | ElementsMediator.setProperties(this.application.ninja.selectedElements, {"left": newLeft, "top": newTop }, null, "Changing", "SelectionTool" ); |
476 | ElementsMediator.setProperties(this.application.ninja.selectedElements, | 451 | } else { |
477 | { "left": newLeft, "top": newTop }, "Changing", "SelectionTool" ); | ||
478 | } | ||
479 | else | ||
480 | { | ||
481 | NJevent("elementChanging", {type : "Changing", redraw: false}); | 452 | NJevent("elementChanging", {type : "Changing", redraw: false}); |
482 | } | 453 | } |
483 | } | 454 | } |