aboutsummaryrefslogtreecommitdiff
path: root/js/tools/TranslateObject3DTool.js
diff options
context:
space:
mode:
authorhwc4872012-04-02 15:40:25 -0700
committerhwc4872012-04-02 15:40:25 -0700
commitdc9650af5760b1f93d6e93a383eabceacfdc0ad8 (patch)
tree6f34187aa4670cfceb276d5b2504d192652847dc /js/tools/TranslateObject3DTool.js
parent7805cc9c59d218ae9fe9cf3fac4fcec1fdf10fae (diff)
downloadninja-dc9650af5760b1f93d6e93a383eabceacfdc0ad8.tar.gz
Snapping fixes.
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-xjs/tools/TranslateObject3DTool.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js
index 60633e74..7163f005 100755
--- a/js/tools/TranslateObject3DTool.js
+++ b/js/tools/TranslateObject3DTool.js
@@ -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;