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/snap-manager.js') 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 903b01b9d0501e6f974034273385a0517107b1e3 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 27 Mar 2012 12:42:42 -0700 Subject: File IO for the brush stroke AND changing the data type of brush stroke from GEOM_TYPE_CUBIC_BEZIER to GEOM_TYPE_BRUSH_STROKE --- js/helper-classes/3D/snap-manager.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/helper-classes/3D/snap-manager.js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index a755e9e2..5b467b41 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1411,6 +1411,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { case glObj.GEOM_TYPE_PATH: // Snapping not implemented for these type, but don't throw an error... break; + case glObj.GEOM_TYPE_BRUSH_STROKE: + break; //don't throw error because snapping not yet implemented case glObj.GEOM_TYPE_CUBIC_BEZIER: { var nearVrt = glObj.getNearVertex( eyePt, dir ); -- cgit v1.2.3