From 40a4d9dbc12e802e2d0a7c3acd69bc7e394d4529 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Fri, 27 Apr 2012 10:03:58 -0700 Subject: Fix for 1525 Pen: "Uncaught RangeError: Maximum call stack size exceeded". (check if the second mouse click actually selects the existing first anchor point) --- js/helper-classes/3D/math-utils.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js index 2f0283a9..35ee8112 100755 --- a/js/helper-classes/3D/math-utils.js +++ b/js/helper-classes/3D/math-utils.js @@ -928,17 +928,18 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { return 0; } //TODO testing...remove this block - console.log("getAxisAngleBetween3DVectors Angle: "+angle); if (isNaN(angle)){ - console.log("getAxisAngleBetween3DVectors Angle is NaN"); + console.log("Warning! getAxisAngleBetween3DVectors Angle is NaN"); } //TODO end testing block //optionally, if axis is provided, create the axis of rotation as well var rotAxis = VecUtils.vecCross(3, v1n, v2n); rotAxis = VecUtils.vecNormalize(3, rotAxis, 1); - axis[0] = rotAxis[0]; - axis[1] = rotAxis[1]; - axis[2] = rotAxis[2]; + if (axis){ + axis[0] = rotAxis[0]; + axis[1] = rotAxis[1]; + axis[2] = rotAxis[2]; + } return angle; } }, -- cgit v1.2.3 From d7555c35b357e28a1e1ccc1c4edc4fe04d2b139a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:39:10 -0700 Subject: fix in the draw utils for drawing the 3d compass Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/draw-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index eef28dce..bef1e435 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1206,7 +1206,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // set the element to be the viewport object - temporarily var tmpCanvas = this.application.ninja.stage.canvas; var tmpStage = this.application.ninja.currentDocument.model.documentRoot; - this.viewUtils.pushViewportObj( tmpCanvas ); +// this.viewUtils.pushViewportObj( tmpCanvas ); // save the source space object and set to the target object var saveSource = this._sourceSpaceElt; @@ -1279,7 +1279,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.drawArrowHead(rO, zO); // restore the state - this.viewUtils.popViewportObj(); +// this.viewUtils.popViewportObj(); this._drawingContext.restore(); this.setDrawingSurfaceElement(saveContext); this._lineColor = saveColor; -- cgit v1.2.3 From e28eb9158a50d7e6d97dbc68066e591ac600c241 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:40:44 -0700 Subject: removing all model creators. The elementModel is now a getter that will create a new model when needed. Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/snap-manager.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index e3756f32..a8b6e739 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -481,10 +481,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { { var snapRec = this._elementCache[i]; var elt = snapRec.getElement(); - if (elt.elementModel) - elt.elementModel.isIn2DSnapCache = false; - else - console.log( "element in the 2D cache does not have an elementModel" ); + elt.elementModel.isIn2DSnapCache = false; + } this._elementCache = null; @@ -541,10 +539,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { snapRec.init( elt ); this._elementCache.push( snapRec ); - if (!elt.elementModel) - { - NJUtils.makeModelFromElement(elt); - } elt.elementModel.isIn2DSnapCache = true; } else if (elt.elementModel) @@ -613,10 +607,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { snapRec.init( elt ); this._elementCache.push( snapRec ); - if (!elt.elementModel) - { - NJUtils.makeModelFromElement(elt); - } elt.elementModel.isIn2DSnapCache = true; } else if (elt.elementModel) -- cgit v1.2.3 From 806974142d44afdd23534bf2d18eff0a8e701e0c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 8 Jun 2012 16:59:59 -0700 Subject: rewrite: currentSelectedContainer -> domContainer Fixed the currentSelectedContainer by removing bindings and using property change on the current document added the red outline back. Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/snap-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index a8b6e739..0157140f 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -496,7 +496,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { this._elementCache = new Array; // var stage = this.getStage(); - var stage = this.application.ninja.currentSelectedContainer || this.getStage(); + var stage = this.application.ninja.currentDocument.model.domContainer || this.getStage(); this.hLoadElementCache( stage, plane, 0 ); this._isCacheInvalid = false; @@ -987,7 +987,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { value: function( screenPt, hitRecs ) { // start at the stage. // var stage = this.getStage(); - var stage = this.application.ninja.currentSelectedContainer || this.getStage(); + var stage = this.application.ninja.currentDocument.model.domContainer || this.getStage(); // the root should be the 'view' canvas, so the first matrix is the camera viewUtils.setViewportObj( stage ); @@ -1009,7 +1009,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } // hit test the current object var hit; - var snapToStage = ((depth === 0) && (elt === this.application.ninja.currentSelectedContainer) && (elt.nodeName === 'CANVAS')); + var snapToStage = ((depth === 0) && (elt === this.application.ninja.currentDocument.model.domContainer) && (elt.nodeName === 'CANVAS')); if ((depth > 0) || snapToStage) // don't snap to the root unles we are working inside a canvas { // if the element is in the 2D cache snapping is done there -- cgit v1.2.3