aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/draw-utils.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-06-19 21:34:35 -0700
committerNivesh Rajbhandari2012-06-19 21:34:35 -0700
commit22e664cdbb4bdf54cde87c0c3223e321e18ea372 (patch)
treeff3697469b8643588a74d5556e8bccf8333af0da /js/helper-classes/3D/draw-utils.js
parent483ad57efcd6475776f580c3af5b60e6deeaf781 (diff)
downloadninja-22e664cdbb4bdf54cde87c0c3223e321e18ea372.tar.gz
IKNINJA-1671 - GIO: 3D rotate widget is offset from the object when rotated in negative space.
I fixed this temporarily by disabling the auto stage scroll calculations when we modify matrices. The correct fix will be to update any matrices and local2Global caches if we update the stage's padding (which I'm doing in a separate fix for a single draw cycle for the stage, but that fix is not ready yet). Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js46
1 files changed, 28 insertions, 18 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 6a84c86b..177c844f 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -247,18 +247,18 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
247 // TODO - Check why handleElementChange is being fired before handleAddElement 247 // TODO - Check why handleElementChange is being fired before handleAddElement
248 handleElementChange: { 248 handleElementChange: {
249 value: function(event) { 249 value: function(event) {
250 this._elementChangeHelper(event); 250 this._elementChangeHelper(event, false);
251 } 251 }
252 }, 252 },
253 253
254 handleElementChanging: { 254 handleElementChanging: {
255 value: function(event) { 255 value: function(event) {
256 this._elementChangeHelper(event); 256 this._elementChangeHelper(event, true);
257 } 257 }
258 }, 258 },
259 259
260 _elementChangeHelper: { 260 _elementChangeHelper: {
261 value: function(event) { 261 value: function(event, isChanging) {
262 if(!event.detail || !event.detail.data) { 262 if(!event.detail || !event.detail.data) {
263 return; 263 return;
264 } 264 }
@@ -273,35 +273,45 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
273 l, 273 l,
274 t, 274 t,
275 plane, 275 plane,
276 changed = false; 276 changed = false,
277 adjustStagePadding = !isChanging || (event.detail.data.prop !== "matrix");
277 for(var i=0; i < len; i++) { 278 for(var i=0; i < len; i++) {
278 plane = els[i].elementModel.props3D.elementPlane; 279 plane = els[i].elementModel.props3D.elementPlane;
279 if(plane) { 280 if(plane) {
280 plane.init(); 281 plane.init();
281 l = plane._rect.m_left - docLeft; 282 if(adjustStagePadding) {
282 t = plane._rect.m_top - docTop; 283 l = plane._rect.m_left - docLeft;
283 if(l < minLeft) { 284 t = plane._rect.m_top - docTop;
284 minLeft = l; 285 if(l < minLeft) {
285 } 286 minLeft = l;
286 if(t < minTop) { 287 }
287 minTop = t; 288 if(t < minTop) {
289 minTop = t;
290 }
288 } 291 }
289 } 292 }
290 } 293 }
291 294
292 if(minLeft !== stage.userPaddingLeft) { 295 if(adjustStagePadding) {
293 stage.userPaddingLeft = minLeft; 296 if(minLeft !== stage.userPaddingLeft) {
294 changed = true; 297 stage.userPaddingLeft = minLeft;
295 } 298 changed = true;
296 if(minTop !== stage.userPaddingTop) { 299 }
297 stage.userPaddingTop = minTop; 300 if(minTop !== stage.userPaddingTop) {
298 changed = true; 301 stage.userPaddingTop = minTop;
302 changed = true;
303 }
299 } 304 }
300 305
301 if(!changed) { 306 if(!changed) {
302 this.drawWorkingPlane(); 307 this.drawWorkingPlane();
303 this.draw3DCompass(); 308 this.draw3DCompass();
304 } 309 }
310
311 // TODO - Remove this once all stage drawing is consolidated into a single draw cycle
312 if(!isChanging) {
313 this.application.ninja.toolsData.selectedToolInstance.captureSelectionDrawn(null);
314 }
305 } 315 }
306 } 316 }
307 }, 317 },