aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorPushkar Joshi2012-04-19 08:01:13 -0700
committerPushkar Joshi2012-04-19 08:01:13 -0700
commita8123f065e7be7566a0588dd87ccac1cd59a0b8e (patch)
tree6493af204dfd3d9730161b5d364194b5f5f346c1 /js
parent6d09ec4a5da89167398b426361dbbf0322493006 (diff)
downloadninja-a8123f065e7be7566a0588dd87ccac1cd59a0b8e.tar.gz
turn off snapping for the pen tool (with an option to turn it back on if we decide to, later)
Diffstat (limited to 'js')
-rwxr-xr-xjs/tools/PenTool.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index a973628f..7263bf52 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -151,7 +151,17 @@ exports.PenTool = Montage.create(ShapeTool, {
151 //use the snap manager to build a hit record corresponding to the screen X, Y position 151 //use the snap manager to build a hit record corresponding to the screen X, Y position
152 // will use the plane of the selected path as the working plane if available, else use stage 152 // will use the plane of the selected path as the working plane if available, else use stage
153 getHitRecord:{ 153 getHitRecord:{
154 value: function(x,y){ 154 value: function(x,y, doSnap){
155 var elemSnap = snapManager.elementSnapEnabled();
156 var gridSnap = snapManager.gridSnapEnabled();
157 var alignSnap = snapManager.snapAlignEnabled();
158
159 if (!doSnap){
160 snapManager.enableElementSnap(false);
161 snapManager.enableGridSnap(false);
162 snapManager.enableSnapAlign(false);
163 }
164
155 if (this._selectedSubpathCanvas){ 165 if (this._selectedSubpathCanvas){
156 var drawingCanvas = this._selectedSubpathCanvas; 166 var drawingCanvas = this._selectedSubpathCanvas;
157 var contentPlane = ViewUtils.getUnprojectedElementPlane(drawingCanvas); 167 var contentPlane = ViewUtils.getUnprojectedElementPlane(drawingCanvas);
@@ -163,6 +173,12 @@ exports.PenTool = Montage.create(ShapeTool, {
163 if (this._selectedSubpathCanvas){ 173 if (this._selectedSubpathCanvas){
164 snapManager.popWorkingPlane(); 174 snapManager.popWorkingPlane();
165 } 175 }
176
177 if (!doSnap){
178 snapManager.enableElementSnap(elemSnap);
179 snapManager.enableGridSnap(gridSnap);
180 snapManager.enableSnapAlign(alignSnap);
181 }
166 return hitRec; 182 return hitRec;
167 } 183 }
168 }, 184 },
@@ -247,7 +263,7 @@ exports.PenTool = Montage.create(ShapeTool, {
247 } 263 }
248 264
249 //build the hit record for the current mouse position (on the stage or the plane of the path canvas) 265 //build the hit record for the current mouse position (on the stage or the plane of the path canvas)
250 var hitRec = this.getHitRecord(event.pageX, event.pageY); 266 var hitRec = this.getHitRecord(event.pageX, event.pageY, false);
251 267
252 if (this._selectedSubpathCanvas === null){ 268 if (this._selectedSubpathCanvas === null){
253 //IF this is the first anchor point of the selected subpath 269 //IF this is the first anchor point of the selected subpath
@@ -409,7 +425,7 @@ exports.PenTool = Montage.create(ShapeTool, {
409 "url('images/cursors/penCursors/Pen_newPath.png') 5 1, default"; 425 "url('images/cursors/penCursors/Pen_newPath.png') 5 1, default";
410 } 426 }
411 427
412 var hitRec = this.getHitRecord(event.pageX, event.pageY); 428 var hitRec = this.getHitRecord(event.pageX, event.pageY, false);
413 429
414 var drawingCanvas=null, globalMousePos=null, localMousePos=null; 430 var drawingCanvas=null, globalMousePos=null, localMousePos=null;
415 if (this._selectedSubpath ){ 431 if (this._selectedSubpath ){