aboutsummaryrefslogtreecommitdiff
path: root/js/tools/TranslateObject3DTool.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-04-20 10:44:02 -0700
committerJose Antonio Marquez2012-04-20 10:44:02 -0700
commit0b7848540a7ca84b7c67821fedc275cf243eff2f (patch)
treea26b2986d412a02eb93fc7fa1b0f495cab40e757 /js/tools/TranslateObject3DTool.js
parent154d1a8fdbbe050dbfc97cd13baa8981d8fc1e47 (diff)
parent8a546291a9d0de3bda1a7765ae9008f2ad052bba (diff)
downloadninja-0b7848540a7ca84b7c67821fedc275cf243eff2f.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into FileIO
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-xjs/tools/TranslateObject3DTool.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js
index 8edf1fee..72a55322 100755
--- a/js/tools/TranslateObject3DTool.js
+++ b/js/tools/TranslateObject3DTool.js
@@ -9,6 +9,7 @@ var Montage = require("montage/core/core").Montage,
9 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, 9 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils,
10 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, 10 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
11 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, 11 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils,
12 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
12 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; 13 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager;
13 14
14exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { 15exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, {
@@ -65,10 +66,8 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, {
65 } 66 }
66 } 67 }
67 68
68 if(this._targets) 69 if(this.application.ninja.selectedElements.length) {
69 { 70 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 71
73 // do the snap before setting up the avoid list to allow 72 // do the snap before setting up the avoid list to allow
74 // a snap on the mouse down 73 // a snap on the mouse down
@@ -96,11 +95,10 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, {
96 } 95 }
97 96
98 // we don't want to snap to selected objects during the drag 97 // we don't want to snap to selected objects during the drag
99 var len = this._targets.length; 98 this.application.ninja.selectedElements.forEach(function(element) {
100 for(var i=0; i<len; i++) 99 snapManager.addToAvoidList(element);
101 { 100 });
102 snapManager.addToAvoidList( this._targets[i].elt ); 101
103 }
104 if (hitRec) 102 if (hitRec)
105 { 103 {
106 // disable snap attributes 104 // disable snap attributes
@@ -122,7 +120,7 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, {
122 120
123 if(!this._dragPlane) 121 if(!this._dragPlane)
124 { 122 {
125 if( this._inLocalMode && (this._targets.length === 1) ) 123 if( this._inLocalMode && (this.application.ninja.selectedElements.length === 1) )
126 { 124 {
127 this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject); 125 this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject);
128 snapManager.setupDragPlaneFromPlane(this._dragPlane); 126 snapManager.setupDragPlaneFromPlane(this._dragPlane);