diff options
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); |