aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js12
-rwxr-xr-xjs/tools/SelectionTool.js9
-rwxr-xr-xjs/tools/Translate3DToolBase.js1
-rwxr-xr-xjs/tools/TranslateObject3DTool.js2
-rwxr-xr-xjs/tools/modifier-tool-base.js2
5 files changed, 16 insertions, 10 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 596ba56a..5eef8b5c 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -1990,12 +1990,20 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1990 }, 1990 },
1991 1991
1992 setupDragPlanes : { 1992 setupDragPlanes : {
1993 value: function( hitRec ) { 1993 value: function( hitRec, inGlobalMode ) {
1994 // get the location of the point in stage world space 1994 // get the location of the point in stage world space
1995 var elt = hitRec.getElt(); 1995 var elt = hitRec.getElt();
1996 var localPt = hitRec.getLocalPoint(); 1996 var localPt = hitRec.getLocalPoint();
1997 var planeMat = hitRec.getPlaneMatrix(); 1997 var planeMat = hitRec.getPlaneMatrix();
1998 var stageWorldPt = viewUtils.postViewToStageWorld( MathUtils.transformPoint(localPt,planeMat), elt ); 1998 var stageWorldPt;
1999 if(inGlobalMode)
2000 {
2001 stageWorldPt = MathUtils.transformPoint(localPt,planeMat);
2002 }
2003 else
2004 {
2005 stageWorldPt = viewUtils.postViewToStageWorld( MathUtils.transformPoint(localPt,planeMat), elt );
2006 }
1999 2007
2000 /* 2008 /*
2001 // get a working plane parallel to the current working plane through the stage world point 2009 // get a working plane parallel to the current working plane through the stage world point
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index 7eee761d..13a04944 100755
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -16,6 +16,7 @@ var Montage = require("montage/core/core").Montage,
16var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { 16var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
17 drawingFeedback: { value: { mode: "Draw2D", type: "" } }, 17 drawingFeedback: { value: { mode: "Draw2D", type: "" } },
18 18
19 _inLocalMode: { value: false}, // This tool should always use global mode for translations
19 _canOperateOnStage: { value: true}, 20 _canOperateOnStage: { value: true},
20 _isSelecting: {value: false, writable:true}, 21 _isSelecting: {value: false, writable:true},
21 _shiftMove: { value: 10}, 22 _shiftMove: { value: 10},
@@ -34,14 +35,12 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
34 value: function () { 35 value: function () {
35 if(this._targets && this._targets.length) 36 if(this._targets && this._targets.length)
36 { 37 {
37 // TODO - drawUtils's elementPlanes check in drawSelectionBounds doesn't seem to work,
38 // so temporary workaround to simply check if all elements have identity matrix
39 // TODO - Eventually, this should instead check if all the selected items are on the view plane
40 var len = this._targets.length; 38 var len = this._targets.length;
39 var plane = this.application.ninja.stage.stageDeps.snapManager.getDragPlane();
41 for(var i = 0; i < len; i++) 40 for(var i = 0; i < len; i++)
42 { 41 {
43 var mat = this._targets[i].mat; 42 var elt = this._targets[i].elt;
44 if(!MathUtils.isIdentityMatrix(mat)) 43 if(!this.application.ninja.stage.stageDeps.snapManager.elementIsOnPlane(elt, plane))
45 { 44 {
46 return false; 45 return false;
47 } 46 }
diff --git a/js/tools/Translate3DToolBase.js b/js/tools/Translate3DToolBase.js
index 3d9191da..24a68ad1 100755
--- a/js/tools/Translate3DToolBase.js
+++ b/js/tools/Translate3DToolBase.js
@@ -10,7 +10,6 @@ Subclass TranslateObject3DTool will translate the object that was clicked.
10var Montage = require("montage/core/core").Montage, 10var Montage = require("montage/core/core").Montage,
11 ModifierToolBase = require("js/tools/modifier-tool-base").ModifierToolBase, 11 ModifierToolBase = require("js/tools/modifier-tool-base").ModifierToolBase,
12 toolHandleModule = require("js/stage/tool-handle"), 12 toolHandleModule = require("js/stage/tool-handle"),
13 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager,
14 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, 13 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils,
15 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, 14 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
16 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, 15 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils,
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js
index 5157e39c..92b9b2f7 100755
--- a/js/tools/TranslateObject3DTool.js
+++ b/js/tools/TranslateObject3DTool.js
@@ -103,7 +103,7 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
103 } 103 }
104 else 104 else
105 { 105 {
106 this._dragPlane = snapManager.setupDragPlanes( hitRec ); 106 this._dragPlane = snapManager.setupDragPlanes( hitRec, true );
107 } 107 }
108 108
109 } 109 }
diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js
index 7e950b03..80f7d758 100755
--- a/js/tools/modifier-tool-base.js
+++ b/js/tools/modifier-tool-base.js
@@ -171,7 +171,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
171// } 171// }
172// else 172// else
173// { 173// {
174 this._dragPlane = snapManager.setupDragPlanes( hitRec ); 174 this._dragPlane = snapManager.setupDragPlanes( hitRec, true );
175// } 175// }
176 } 176 }
177 177