aboutsummaryrefslogtreecommitdiff
path: root/js/tools/TranslateObject3DTool.js
diff options
context:
space:
mode:
authorEric Guzman2012-03-19 11:52:35 -0700
committerEric Guzman2012-03-19 11:52:35 -0700
commitdde5b5054f93db493e5d4d502e677f5781334b08 (patch)
tree4960525a5b183f0e966462c566817331bea0f3cd /js/tools/TranslateObject3DTool.js
parentf08e3660384ed6ed2ba8ecf959c90fd1ade818eb (diff)
parent954f5a13e371febcb1c0fb8015c577ee51c23130 (diff)
downloadninja-dde5b5054f93db493e5d4d502e677f5781334b08.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/tools/TranslateObject3DTool.js')
-rwxr-xr-xjs/tools/TranslateObject3DTool.js40
1 files changed, 32 insertions, 8 deletions
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js
index 92b9b2f7..60633e74 100755
--- a/js/tools/TranslateObject3DTool.js
+++ b/js/tools/TranslateObject3DTool.js
@@ -32,6 +32,7 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
32 this._snapToGrid = snapManager.gridSnapEnabledAppLevel(); 32 this._snapToGrid = snapManager.gridSnapEnabledAppLevel();
33 33
34 this._dragPlane = null; 34 this._dragPlane = null;
35 this._clickedOnStage = false;
35 var do3DSnap = true; 36 var do3DSnap = true;
36 37
37 if(this._handleMode === null) 38 if(this._handleMode === null)
@@ -43,9 +44,9 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
43 } 44 }
44 else 45 else
45 { 46 {
46 this._delta = 0; 47 this._delta = null;
47 // special case for z-translation 48 // special case for z-translation
48 if( this._handleMode && (this._handleMode === 2) ) 49 if(this._handleMode === 2)
49 { 50 {
50 this._dragPlane = viewUtils.getNormalToUnprojectedElementPlane(this._target); 51 this._dragPlane = viewUtils.getNormalToUnprojectedElementPlane(this._target);
51 snapManager.setupDragPlaneFromPlane(this._dragPlane); 52 snapManager.setupDragPlaneFromPlane(this._dragPlane);
@@ -65,11 +66,25 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
65 // a snap on the mouse down 66 // a snap on the mouse down
66 var hitRec = snapManager.snap(point.x, point.y, do3DSnap); 67 var hitRec = snapManager.snap(point.x, point.y, do3DSnap);
67 68
68 // TODO - Check that hitRec's element matches element that browser says we clicked on 69 if(this._handleMode === 2)
69 var elt = this.application.ninja.stage.GetElement(event);
70 if(elt !== hitRec.getElement())
71 { 70 {
72 hitRec = snapManager.findHitRecordForElement(elt); 71 // translate z doesn't snap to element so hitRec's element will always be different
72 // from what the browser says we clicked on. So, skip this check.
73 }
74 else
75 {
76 // Check that hitRec's element matches element that browser says we clicked on
77 // TODO - This is still not working when using a handle that is on top of an
78 // element that is not currently selected
79 var elt = this.application.ninja.stage.GetSelectableElement(event);
80 if(elt && (elt !== hitRec.getElement()))
81 {
82 hitRec = snapManager.findHitRecordForElement(elt);
83 }
84 if(elt === this.application.ninja.currentSelectedContainer)
85 {
86 this._clickedOnStage = true;
87 }
73 } 88 }
74 89
75 // we don't want to snap to selected objects during the drag 90 // we don't want to snap to selected objects during the drag
@@ -91,8 +106,17 @@ exports.TranslateObject3DTool = Object.create(Translate3DToolBase, {
91 snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); 106 snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() );
92 } 107 }
93 108
94 // parameterize the snap point on the target 109 if(this._handleMode === 2)
95 this._snapParam = this.parameterizeSnap( hitRec ); 110 {
111 // TODO - not sure how to parameterize point in z-translate mode
112 this.clickedObject = this._target;
113 this._snapParam = [0, 0, 0];
114 }
115 else
116 {
117 // parameterize the snap point on the target
118 this._snapParam = this.parameterizeSnap( hitRec );
119 }
96 120
97 if(!this._dragPlane) 121 if(!this._dragPlane)
98 { 122 {