diff options
Diffstat (limited to 'js/tools/RotateObject3DTool.js')
-rwxr-xr-x | js/tools/RotateObject3DTool.js | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/js/tools/RotateObject3DTool.js b/js/tools/RotateObject3DTool.js index c1ddb286..ec2fcc0c 100755 --- a/js/tools/RotateObject3DTool.js +++ b/js/tools/RotateObject3DTool.js | |||
@@ -58,148 +58,6 @@ exports.RotateObject3DTool = Montage.create(Rotate3DToolBase, { | |||
58 | } | 58 | } |
59 | }, | 59 | }, |
60 | 60 | ||
61 | initializeSnapping : { | ||
62 | value : function(event) | ||
63 | { | ||
64 | // console.log( "initializeSnapping" ); | ||
65 | |||
66 | var selectedElements = this.application.ninja.selectedElements; | ||
67 | if(this.rotateStage) { | ||
68 | selectedElements = [this.application.ninja.currentDocument.documentRoot]; | ||
69 | } | ||
70 | |||
71 | this._mouseDownHitRec = null; | ||
72 | this._mouseUpHitRec = null; | ||
73 | |||
74 | snapManager.clearAvoidList(); | ||
75 | snapManager.clearDragPlane(); | ||
76 | |||
77 | // the translate tool does snap align to the bounds of the object only. | ||
78 | // turn off snap align to the cursor. This needs to be re-enabled in the mouse up method | ||
79 | snapManager.enableSnapAlign( false ); | ||
80 | |||
81 | // snap to element and snap to grid are conditionally enabled based | ||
82 | // on the snap results of the mouse down. enable everything for the first snap | ||
83 | this._snapToElements = snapManager.elementSnapEnabledAppLevel(); | ||
84 | this._snapToGrid = snapManager.gridSnapEnabledAppLevel(); | ||
85 | |||
86 | this._dragPlane = null; | ||
87 | this._clickedOnStage = false; | ||
88 | var do3DSnap = true; | ||
89 | |||
90 | if(this._handleMode === null) | ||
91 | { | ||
92 | snapManager.enableElementSnap ( true ); | ||
93 | snapManager.enableGridSnap ( true ); | ||
94 | } | ||
95 | // else | ||
96 | // { | ||
97 | // this._delta = null; | ||
98 | // special case for z-translation | ||
99 | // if(this._handleMode === 0) | ||
100 | // { | ||
101 | // this._dragPlane = viewUtils.getNormalToUnprojectedElementPlane(this._target); | ||
102 | // snapManager.setupDragPlaneFromPlane(this._dragPlane); | ||
103 | // do3DSnap = false; | ||
104 | |||
105 | // snapManager.enableElementSnap ( false ); | ||
106 | // snapManager.enableGridSnap ( false ); | ||
107 | // } | ||
108 | // } | ||
109 | |||
110 | if (selectedElements.length) | ||
111 | { | ||
112 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, | ||
113 | new WebKitPoint(event.pageX, event.pageY)); | ||
114 | |||
115 | // do the snap before setting up the avoid list to allow | ||
116 | // a snap on the mouse down | ||
117 | var hitRec = snapManager.snap(point.x, point.y, do3DSnap); | ||
118 | |||
119 | // if(this._handleMode === 2) | ||
120 | // { | ||
121 | // // translate z doesn't snap to element so hitRec's element will always be different | ||
122 | // // from what the browser says we clicked on. So, skip this check. | ||
123 | // } | ||
124 | // else | ||
125 | // { | ||
126 | // // Check that hitRec's element matches element that browser says we clicked on | ||
127 | // // TODO - This is still not working when using a handle that is on top of an | ||
128 | // // element that is not currently selected | ||
129 | // var elt = this.application.ninja.stage.GetSelectableElement(event); | ||
130 | // if(elt && (elt !== hitRec.getElement())) | ||
131 | // { | ||
132 | // hitRec = snapManager.findHitRecordForElement(elt); | ||
133 | // } | ||
134 | // if(elt === this.application.ninja.currentSelectedContainer) | ||
135 | // { | ||
136 | // this._clickedOnStage = true; | ||
137 | // } | ||
138 | // } | ||
139 | |||
140 | // we don't want to snap to selected objects during the drag | ||
141 | // var len = this._targets.length; | ||
142 | // for(var i=0; i<len; i++) | ||
143 | // { | ||
144 | // snapManager.addToAvoidList( this._targets[i].elt ); | ||
145 | // } | ||
146 | if (hitRec) | ||
147 | { | ||
148 | // disable snap attributes | ||
149 | if (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT) | ||
150 | { | ||
151 | this._snapToElements = false; | ||
152 | this._snapToGrid = false; | ||
153 | } | ||
154 | else if (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT_CENTER) | ||
155 | { | ||
156 | snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); | ||
157 | } | ||
158 | |||
159 | if(this._handleMode === 0) | ||
160 | this.clickedObject = this._target; | ||
161 | |||
162 | // parameterize the snap point on the target | ||
163 | this._snapParam = this.parameterizeSnap( hitRec ); | ||
164 | |||
165 | if(!this._dragPlane) | ||
166 | { | ||
167 | if (selectedElements.length === 1) | ||
168 | { | ||
169 | this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject); | ||
170 | snapManager.setupDragPlaneFromPlane(this._dragPlane); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | this._dragPlane = snapManager.setupDragPlanes( hitRec, true ); | ||
175 | } | ||
176 | |||
177 | } | ||
178 | |||
179 | // no quadrant snapping for the rotate tool | ||
180 | this._shouldUseQuadPt = false; | ||
181 | |||
182 | var wpHitRec = hitRec.convertToWorkingPlane( this._dragPlane ); | ||
183 | this._mouseDownHitRec = wpHitRec; | ||
184 | this._mouseUpHitRec = null; | ||
185 | |||
186 | var pt = hitRec.getScreenPoint(); | ||
187 | this.downPoint.x = pt[0]; | ||
188 | this.downPoint.y = pt[1]; | ||
189 | this.downPoint.z = pt[2]; | ||
190 | |||
191 | // TODO - need to figure out snapManager dependency by drawUtils. | ||
192 | // For now, bypassing by calling snapManager.drawLastHit(); | ||
193 | // drawUtils.refreshDisplay(); | ||
194 | // snapManager.drawLastHit(); | ||
195 | } | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | this.target = null; | ||
200 | } | ||
201 | } | ||
202 | }, | ||
203 | _handleToolOptionsChange: { | 61 | _handleToolOptionsChange: { |
204 | value: function(event) { | 62 | value: function(event) { |
205 | this._inLocalMode = event.detail.mode; | 63 | this._inLocalMode = event.detail.mode; |