aboutsummaryrefslogtreecommitdiff
path: root/js/tools/TranslateObject3DTool.js
diff options
context:
space:
mode:
authorhwc4872012-04-05 17:09:51 -0700
committerhwc4872012-04-05 17:09:51 -0700
commit2d21b01d6dd64af643f5f38818b57fcace05ea0b (patch)
tree44fac83294dae2efad48389ddb44cb1dbe06caad /js/tools/TranslateObject3DTool.js
parent7656b6eac7aec59697c6cddbe2a507fe9e4aa187 (diff)
parent96bfeee2e6b735b87e8482d6e2cf24d5224c6417 (diff)
downloadninja-2d21b01d6dd64af643f5f38818b57fcace05ea0b.tar.gz
Merge branch 'Snapping' of github.com:ericmueller/ninja-internal into Snapping_II
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-xjs/tools/TranslateObject3DTool.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js
index 60633e74..867bec7f 100755
--- a/js/tools/TranslateObject3DTool.js
+++ b/js/tools/TranslateObject3DTool.js
@@ -7,6 +7,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7var Translate3DToolBase = require("js/tools/Translate3DToolBase").Translate3DToolBase, 7var Translate3DToolBase = require("js/tools/Translate3DToolBase").Translate3DToolBase,
8 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, 8 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils,
9 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, 9 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils,
10 vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils,
10 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; 11 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager;
11 12
12exports.TranslateObject3DTool = Object.create(Translate3DToolBase, { 13exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
@@ -16,6 +17,8 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
16 initializeSnapping : { 17 initializeSnapping : {
17 value : function(event) 18 value : function(event)
18 { 19 {
20 console.log( "initializeSnapping" );
21
19 this._mouseDownHitRec = null; 22 this._mouseDownHitRec = null;
20 this._mouseUpHitRec = null; 23 this._mouseUpHitRec = null;
21 24
@@ -37,8 +40,6 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
37 40
38 if(this._handleMode === null) 41 if(this._handleMode === null)
39 { 42 {
40// this.doSelection(event);
41
42 snapManager.enableElementSnap ( true ); 43 snapManager.enableElementSnap ( true );
43 snapManager.enableGridSnap ( true ); 44 snapManager.enableGridSnap ( true );
44 } 45 }
@@ -107,16 +108,10 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
107 } 108 }
108 109
109 if(this._handleMode === 2) 110 if(this._handleMode === 2)
110 {
111 // TODO - not sure how to parameterize point in z-translate mode
112 this.clickedObject = this._target; 111 this.clickedObject = this._target;
113 this._snapParam = [0, 0, 0]; 112
114 } 113 // parameterize the snap point on the target
115 else 114 this._snapParam = this.parameterizeSnap( hitRec );
116 {
117 // parameterize the snap point on the target
118 this._snapParam = this.parameterizeSnap( hitRec );
119 }
120 115
121 if(!this._dragPlane) 116 if(!this._dragPlane)
122 { 117 {
@@ -132,6 +127,11 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
132 127
133 } 128 }
134 129
130 // only do quadrant snapping if the 4 corners of the element are in the drag plane
131
132 var sign = MathUtils.fpSign( vecUtils.vecDot(3,this._dragPlane,[0,0,1]) + this._dragPlane[3] - 1.0);
133 this._shouldUseQuadPt = (sign == 0);
134
135 var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); 135 var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane );
136 this._mouseDownHitRec = wpHitRec; 136 this._mouseDownHitRec = wpHitRec;
137 this._mouseUpHitRec = null; 137 this._mouseUpHitRec = null;