diff options
author | Valerio Virgillito | 2012-04-17 11:08:29 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-17 11:08:29 -0700 |
commit | 2292a35f545a161c0d19b26a8640b9421afce792 (patch) | |
tree | c9a64c50dd4c42cdbd221e35548418fe883c2d13 /js/tools/TranslateObject3DTool.js | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
parent | 7ed5215332123d16f819a7a26c651af520a68669 (diff) | |
download | ninja-2292a35f545a161c0d19b26a8640b9421afce792.tar.gz |
Merge pull request #163 from mencio/undo-manager
Undo manager - Fixing a couple undo bugs and architecture work to support undo/redo
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-x | js/tools/TranslateObject3DTool.js | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js index 8edf1fee..74df6c14 100755 --- a/js/tools/TranslateObject3DTool.js +++ b/js/tools/TranslateObject3DTool.js | |||
@@ -65,10 +65,8 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | if(this._targets) | 68 | if(this.application.ninja.selectedElements.length) { |
69 | { | 69 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); |
70 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, | ||
71 | new WebKitPoint(event.pageX, event.pageY)); | ||
72 | 70 | ||
73 | // do the snap before setting up the avoid list to allow | 71 | // do the snap before setting up the avoid list to allow |
74 | // a snap on the mouse down | 72 | // a snap on the mouse down |
@@ -96,11 +94,10 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
96 | } | 94 | } |
97 | 95 | ||
98 | // we don't want to snap to selected objects during the drag | 96 | // we don't want to snap to selected objects during the drag |
99 | var len = this._targets.length; | 97 | this.application.ninja.selectedElements.forEach(function(element) { |
100 | for(var i=0; i<len; i++) | 98 | snapManager.addToAvoidList(element); |
101 | { | 99 | }); |
102 | snapManager.addToAvoidList( this._targets[i].elt ); | 100 | |
103 | } | ||
104 | if (hitRec) | 101 | if (hitRec) |
105 | { | 102 | { |
106 | // disable snap attributes | 103 | // disable snap attributes |
@@ -122,7 +119,7 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
122 | 119 | ||
123 | if(!this._dragPlane) | 120 | if(!this._dragPlane) |
124 | { | 121 | { |
125 | if( this._inLocalMode && (this._targets.length === 1) ) | 122 | if( this._inLocalMode && (this.application.ninja.selectedElements.length === 1) ) |
126 | { | 123 | { |
127 | this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject); | 124 | this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject); |
128 | snapManager.setupDragPlaneFromPlane(this._dragPlane); | 125 | snapManager.setupDragPlaneFromPlane(this._dragPlane); |