From 521df0ed9242efff45715998837068c87aca7efd Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 13 Apr 2012 11:12:40 -0700 Subject: 3D Rotate changes --- js/helper-classes/3D/draw-utils.js | 48 +++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index c7c1c08d..a200268e 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -774,13 +774,14 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { else { // get the plane from the first element to compare against the other elements + var dot; var flat = true; - var plane = this.viewUtils.getElementPlane( eltArray[0] ); + var plane = this.viewUtils.getUnprojectedElementPlane( eltArray[0] ); for (i=1; i 0) || (back > 0)) ? dark : light; context.beginPath(); if ((right > 0) || (back > 0)) { context.beginPath(); - p = this.viewUtils.localToGlobal2( [x1, y0, z0], ssMat ); context.moveTo( p[0], p[1] ); + p = this.viewUtils.localToGlobal2( [x1, y0, z0], ssMat ); context.moveTo( p[0], p[1] ); p = this.viewUtils.localToGlobal2( [x1, y1, z0], ssMat ); context.lineTo( p[0], p[1] ); context.closePath(); context.stroke(); } -- cgit v1.2.3 From f11ed767396996c236bb8ef0e5f89fedddcaa0d7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 17 Apr 2012 13:27:40 -0700 Subject: Grid should redraw on elementChanging as well as elementChange. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index a5428ea3..ec8eea0f 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -111,6 +111,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.eventManager.addEventListener("elementAdded", this, false); this.eventManager.addEventListener("elementsRemoved", this, false); this.eventManager.addEventListener("elementChange", this, false); + this.eventManager.addEventListener("elementChanging", this, false); this.eventManager.addEventListener("closeDocument", this, false); this.eventManager.addEventListener("elementReplaced", this, false); } @@ -227,20 +228,26 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // TODO - Check why handleElementChange is being fired before handleAddElement handleElementChange: { value: function(event) { - if(!event.detail || !event.detail.data) - { + this._elementChangeHelper(event); + } + }, + + handleElementChanging: { + value: function(event) { + this._elementChangeHelper(event); + } + }, + + _elementChangeHelper: { + value: function(event) { + if(!event.detail || !event.detail.data) { return; } var els = event.detail.data.els; - if(els && this._shouldUpdatePlanes(event.detail.data.prop)) - { - var len = els.length, - i = 0, - item; - - for(i=0; i < len; i++) { - if(els[i].elementModel.props3D.elementPlane) - { + if(els && this._shouldUpdatePlanes(event.detail.data.prop)) { + var len = els.length; + for(var i=0; i < len; i++) { + if(els[i].elementModel.props3D.elementPlane) { els[i].elementModel.props3D.elementPlane.init(); } } -- cgit v1.2.3 From 7b3ef287f248c07602aefa3ba2cc907e0d16493a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 18 Apr 2012 13:42:18 -0700 Subject: Fixing some more merge issues. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 42e0cfa9..039f5bb3 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -796,7 +796,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { context.stroke(); this._selectionCtr = MathUtils.getCenterFromBounds(3, bounds3D); - console.log("selection center, single elt case - ", this._selectionCtr); +// console.log("selection center, single elt case - ", this._selectionCtr); this.viewUtils.popViewportObj(); } @@ -837,7 +837,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { if (MathUtils.fpCmp(dot, 1) != 0) flat = false; } - console.log( "drawSelectionBounds, flat: " + flat ); +// console.log( "drawSelectionBounds, flat: " + flat ); // if all the elements share the same plane, draw the 2D rectangle if (flat) -- cgit v1.2.3