diff options
author | Nivesh Rajbhandari | 2012-04-04 17:24:27 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-04 17:24:27 -0700 |
commit | 01cf259da7aaa7d70789d9a7c32111d88b477463 (patch) | |
tree | 0bff3395ac681e5f685d2267f7dbc03a8e32bc4a /js/tools/TranslateObject3DTool.js | |
parent | 331ea08655245e3532e48bf160d5f68a04d8723f (diff) | |
parent | 13368ca6ebbc13adeafccd898dfffd7ce37cb28a (diff) | |
download | ninja-01cf259da7aaa7d70789d9a7c32111d88b477463.tar.gz |
Merge branch 'refs/heads/ToolFixes' into WebGLMaterials
Conflicts:
js/document/templates/montage-html/default_html.css
js/mediators/element-mediator.js
js/panels/properties.reel/properties.js
js/tools/BrushTool.js
js/tools/LineTool.js
js/tools/PenTool.js
js/tools/SelectionTool.js
js/tools/ShapeTool.js
js/tools/TranslateObject3DTool.js
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-x | js/tools/TranslateObject3DTool.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js index 4fac8187..8edf1fee 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 | |||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Translate3DToolBase = require("js/tools/Translate3DToolBase").Translate3DToolBase, | 8 | Translate3DToolBase = require("js/tools/Translate3DToolBase").Translate3DToolBase, |
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 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | 11 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, |
11 | snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; | 12 | snapManager = require("js/helper-classes/3D/snap-manager").SnapManager; |
12 | 13 | ||
@@ -23,6 +24,8 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
23 | initializeSnapping : { | 24 | initializeSnapping : { |
24 | value : function(event) | 25 | value : function(event) |
25 | { | 26 | { |
27 | // console.log( "initializeSnapping" ); | ||
28 | |||
26 | this._mouseDownHitRec = null; | 29 | this._mouseDownHitRec = null; |
27 | this._mouseUpHitRec = null; | 30 | this._mouseUpHitRec = null; |
28 | 31 | ||
@@ -44,8 +47,6 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
44 | 47 | ||
45 | if(this._handleMode === null) | 48 | if(this._handleMode === null) |
46 | { | 49 | { |
47 | // this.doSelection(event); | ||
48 | |||
49 | snapManager.enableElementSnap ( true ); | 50 | snapManager.enableElementSnap ( true ); |
50 | snapManager.enableGridSnap ( true ); | 51 | snapManager.enableGridSnap ( true ); |
51 | } | 52 | } |
@@ -114,16 +115,10 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
114 | } | 115 | } |
115 | 116 | ||
116 | if(this._handleMode === 2) | 117 | if(this._handleMode === 2) |
117 | { | ||
118 | // TODO - not sure how to parameterize point in z-translate mode | ||
119 | this.clickedObject = this._target; | 118 | this.clickedObject = this._target; |
120 | this._snapParam = [0, 0, 0]; | 119 | |
121 | } | 120 | // parameterize the snap point on the target |
122 | else | 121 | this._snapParam = this.parameterizeSnap( hitRec ); |
123 | { | ||
124 | // parameterize the snap point on the target | ||
125 | this._snapParam = this.parameterizeSnap( hitRec ); | ||
126 | } | ||
127 | 122 | ||
128 | if(!this._dragPlane) | 123 | if(!this._dragPlane) |
129 | { | 124 | { |
@@ -139,6 +134,11 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, { | |||
139 | 134 | ||
140 | } | 135 | } |
141 | 136 | ||
137 | // only do quadrant snapping if the 4 corners of the element are in the drag plane | ||
138 | |||
139 | var sign = MathUtils.fpSign( vecUtils.vecDot(3,this._dragPlane,[0,0,1]) + this._dragPlane[3] - 1.0); | ||
140 | this._shouldUseQuadPt = (sign == 0); | ||
141 | |||
142 | var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); | 142 | var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); |
143 | this._mouseDownHitRec = wpHitRec; | 143 | this._mouseDownHitRec = wpHitRec; |
144 | this._mouseUpHitRec = null; | 144 | this._mouseUpHitRec = null; |