aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorPushkar Joshi2012-03-01 11:22:46 -0800
committerPushkar Joshi2012-03-01 11:22:46 -0800
commitd7d78d4a4e8cf82c56379d25efbe679b3b823abc (patch)
treedddb086983ac7724b1b1c2cfb88e7904f3eb8c43 /js/tools
parent271a8f2b29d87d12c81d03e3f1e2c05b816a138d (diff)
downloadninja-d7d78d4a4e8cf82c56379d25efbe679b3b823abc.tar.gz
show feedback on mouseover on a part of the path where a new anchor will be added if clicked
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PenTool.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index ddc8bc04..02367328 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -275,6 +275,9 @@ exports.PenTool = Montage.create(ShapeTool, {
275 this.application.ninja.stage.clearDrawingCanvas(); 275 this.application.ninja.stage.clearDrawingCanvas();
276 this._hoveredAnchorIndex = -1; 276 this._hoveredAnchorIndex = -1;
277 277
278 //set the cursor to be the default cursor
279 this.application.ninja.stage.drawingCanvas.style.cursor = "auto";
280
278 if (this._isDrawing) { 281 if (this._isDrawing) {
279 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); 282 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY));
280 //go through the drawing toolbase to get the position of the mouse 283 //go through the drawing toolbase to get the position of the mouse
@@ -345,6 +348,14 @@ exports.PenTool = Montage.create(ShapeTool, {
345 var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); 348 var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS);
346 if (selAnchor >=0) { 349 if (selAnchor >=0) {
347 this._hoveredAnchorIndex = selAnchor; 350 this._hoveredAnchorIndex = selAnchor;
351 } else {
352 //detect if the current mouse position will hit the path
353 var pathHitTestData = this._selectedSubpath.pathHitTest(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS);
354 if (pathHitTestData[0]!==-1){
355 //change the cursor
356 var cursor = "url('images/cursors/penAdd.png') 10 10,default";
357 this.application.ninja.stage.drawingCanvas.style.cursor = cursor;
358 }
348 } 359 }
349 } 360 }
350 } //else of if (this._isDrawing) { 361 } //else of if (this._isDrawing) {
@@ -353,7 +364,6 @@ exports.PenTool = Montage.create(ShapeTool, {
353 if (this._selectedSubpath){ 364 if (this._selectedSubpath){
354 this.DrawSubpathAnchors(this._selectedSubpath); 365 this.DrawSubpathAnchors(this._selectedSubpath);
355 } 366 }
356
357 }//value: function(event) 367 }//value: function(event)
358 },//HandleMouseMove 368 },//HandleMouseMove
359 369