diff options
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-x | js/tools/TranslateObject3DTool.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js index 60633e74..9fa49229 100755 --- a/js/tools/TranslateObject3DTool.js +++ b/js/tools/TranslateObject3DTool.js | |||
@@ -5,7 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Translate3DToolBase = require("js/tools/Translate3DToolBase").Translate3DToolBase, | 7 | var Translate3DToolBase = require("js/tools/Translate3DToolBase").Translate3DToolBase, |
8 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | 8 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, |
9 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | 9 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, |
10 | snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; | 10 | snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; |
11 | 11 | ||
@@ -16,6 +16,8 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, { | |||
16 | initializeSnapping : { | 16 | initializeSnapping : { |
17 | value : function(event) | 17 | value : function(event) |
18 | { | 18 | { |
19 | // console.log( "initializeSnapping" ); | ||
20 | |||
19 | this._mouseDownHitRec = null; | 21 | this._mouseDownHitRec = null; |
20 | this._mouseUpHitRec = null; | 22 | this._mouseUpHitRec = null; |
21 | 23 | ||
@@ -37,8 +39,6 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, { | |||
37 | 39 | ||
38 | if(this._handleMode === null) | 40 | if(this._handleMode === null) |
39 | { | 41 | { |
40 | // this.doSelection(event); | ||
41 | |||
42 | snapManager.enableElementSnap ( true ); | 42 | snapManager.enableElementSnap ( true ); |
43 | snapManager.enableGridSnap ( true ); | 43 | snapManager.enableGridSnap ( true ); |
44 | } | 44 | } |
@@ -107,16 +107,10 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, { | |||
107 | } | 107 | } |
108 | 108 | ||
109 | if(this._handleMode === 2) | 109 | if(this._handleMode === 2) |
110 | { | ||
111 | // TODO - not sure how to parameterize point in z-translate mode | ||
112 | this.clickedObject = this._target; | 110 | this.clickedObject = this._target; |
113 | this._snapParam = [0, 0, 0]; | 111 | |
114 | } | 112 | // parameterize the snap point on the target |
115 | else | 113 | this._snapParam = this.parameterizeSnap( hitRec ); |
116 | { | ||
117 | // parameterize the snap point on the target | ||
118 | this._snapParam = this.parameterizeSnap( hitRec ); | ||
119 | } | ||
120 | 114 | ||
121 | if(!this._dragPlane) | 115 | if(!this._dragPlane) |
122 | { | 116 | { |
@@ -132,6 +126,11 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, { | |||
132 | 126 | ||
133 | } | 127 | } |
134 | 128 | ||
129 | // only do quadrant snapping if the 4 corners of the element are in the drag plane | ||
130 | |||
131 | var sign = MathUtils.fpSign( vecUtils.vecDot(3,this._dragPlane,[0,0,1]) + this._dragPlane[3] - 1.0); | ||
132 | this._shouldUseQuadPt = (sign == 0); | ||
133 | |||
135 | var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); | 134 | var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); |
136 | this._mouseDownHitRec = wpHitRec; | 135 | this._mouseDownHitRec = wpHitRec; |
137 | this._mouseUpHitRec = null; | 136 | this._mouseUpHitRec = null; |