From 9c7f7c69495175a4a5a093aeb78f078d0cb7835d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 16 Mar 2012 17:14:54 -0700 Subject: Fixed snap-manager to stop snapping after first level children. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 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 1caacd00..a755e9e2 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -471,7 +471,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { value: function( plane ) { this._elementCache = new Array; - var stage = this.getStage(); +// var stage = this.getStage(); + var stage = this.application.ninja.currentSelectedContainer || this.getStage(); this.hLoadElementCache( stage, plane, 0 ); this._isCacheInvalid = false; @@ -570,6 +571,11 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { hLoadElementCache : { value: function( elt, plane, depth ) { + if(depth > 1) + { + return; + } + if (depth > 0) { // check if the element is on the specified plane @@ -590,8 +596,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { elt.elementModel.isIn2DSnapCache = false; } - // TODO - Don't traverse components' children -// if(elt.elementModel && elt.elementModel.isComponent) + // TODO - Don't traverse svg and components' children if(elt.nodeName.toLowerCase() === "svg" || (elt.elementModel && (elt.elementModel.isComponent || (elt.elementModel.selection === "SVG")))) { return; @@ -964,7 +969,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { snapToElements : { value: function( screenPt, hitRecs ) { // start at the stage. - var stage = this.getStage(); +// var stage = this.getStage(); + var stage = this.application.ninja.currentSelectedContainer || this.getStage(); // the root should be the 'view' canvas, so the first matrix is the camera viewUtils.setViewportObj( stage ); @@ -980,6 +986,10 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { { value: function( elt, hitRecs, depth, globalScrPt ) { + if(depth > 1) + { + return; + } // hit test the current object var hit; if (depth > 0) // don't snap to the root @@ -1001,8 +1011,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } } - // TODO - Don't traverse components' children -// if(elt.elementModel && elt.elementModel.isComponent) + // TODO - Don't traverse svg and components' children if(elt.nodeName.toLowerCase() === "svg" || (elt.elementModel && (elt.elementModel.isComponent || (elt.elementModel.selection === "SVG")))) { return; -- cgit v1.2.3 From e33b3ce6f7b6789cfe854d4a6a8bb5bd57b8ae37 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 20 Mar 2012 06:45:06 -0700 Subject: Fixing error in drawUtils when closing document - should set _eltArray and _planesArray's length to 0 instead of setting the arrays to null. 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') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 1c00f7ea..d6334e6c 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -139,8 +139,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { handleCloseDocument:{ value: function() { if(this.application.ninja.documentController._documents.length === 0){ - this._eltArray = null; - this._planesArray = null; + this._eltArray.length = 0; + this._planesArray.length = 0; } } }, -- cgit v1.2.3