aboutsummaryrefslogtreecommitdiff
path: root/js/tools/PenTool.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-14 15:17:01 -0700
committerJose Antonio Marquez2012-03-14 15:17:01 -0700
commite7e18f02870a0cfe06e550acf8ffef6eab945231 (patch)
treec940a63fd47e60f121c42b1823194522c8c2820f /js/tools/PenTool.js
parentef601b13a2529c207eb782942e918212e5a0805e (diff)
parent089534a80c64226bf7d124ab9147afce386fdb5c (diff)
downloadninja-e7e18f02870a0cfe06e550acf8ffef6eab945231.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js/tools/PenTool.js')
-rwxr-xr-xjs/tools/PenTool.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 71a91870..60ef4f92 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -278,6 +278,9 @@ exports.PenTool = Montage.create(ShapeTool, {
278 this.application.ninja.stage.clearDrawingCanvas(); 278 this.application.ninja.stage.clearDrawingCanvas();
279 this._hoveredAnchorIndex = -1; 279 this._hoveredAnchorIndex = -1;
280 280
281 //set the cursor to be the default cursor
282 this.application.ninja.stage.drawingCanvas.style.cursor = "auto";
283
281 if (this._isDrawing) { 284 if (this._isDrawing) {
282 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); 285 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY));
283 //go through the drawing toolbase to get the position of the mouse 286 //go through the drawing toolbase to get the position of the mouse
@@ -348,6 +351,14 @@ exports.PenTool = Montage.create(ShapeTool, {
348 var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); 351 var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS);
349 if (selAnchor >=0) { 352 if (selAnchor >=0) {
350 this._hoveredAnchorIndex = selAnchor; 353 this._hoveredAnchorIndex = selAnchor;
354 } else {
355 //detect if the current mouse position will hit the path
356 var pathHitTestData = this._selectedSubpath.pathHitTest(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS);
357 if (pathHitTestData[0]!==-1){
358 //change the cursor
359 var cursor = "url('images/cursors/penAdd.png') 10 10,default";
360 this.application.ninja.stage.drawingCanvas.style.cursor = cursor;
361 }
351 } 362 }
352 } 363 }
353 } //else of if (this._isDrawing) { 364 } //else of if (this._isDrawing) {
@@ -356,7 +367,6 @@ exports.PenTool = Montage.create(ShapeTool, {
356 if (this._selectedSubpath){ 367 if (this._selectedSubpath){
357 this.DrawSubpathAnchors(this._selectedSubpath); 368 this.DrawSubpathAnchors(this._selectedSubpath);
358 } 369 }
359
360 }//value: function(event) 370 }//value: function(event)
361 },//HandleMouseMove 371 },//HandleMouseMove
362 372
@@ -457,9 +467,9 @@ exports.PenTool = Montage.create(ShapeTool, {
457 if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){ 467 if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){
458 this._selectedSubpath.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor); 468 this._selectedSubpath.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor);
459 } 469 }
460 if (this.application.ninja.colorController.colorToolbar.fill.webGlColor){ 470 //if (this.application.ninja.colorController.colorToolbar.fill.webGlColor){
461 this._selectedSubpath.setFillColor(this.application.ninja.colorController.colorToolbar.fill.webGlColor); 471 // this._selectedSubpath.setFillColor(this.application.ninja.colorController.colorToolbar.fill.webGlColor);
462 } 472 //}
463 } //if this is a new path being rendered 473 } //if this is a new path being rendered
464 474
465 this._selectedSubpath.makeDirty(); 475 this._selectedSubpath.makeDirty();