aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PenTool.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 39a1b15a..57da4698 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -72,7 +72,7 @@ exports.PenTool = Montage.create(ShapeTool, {
72 _hoveredAnchorIndex: {value: -1, writable: true}, 72 _hoveredAnchorIndex: {value: -1, writable: true},
73 73
74 //constants used for picking points --- NOTE: these should be user-settable parameters 74 //constants used for picking points --- NOTE: these should be user-settable parameters
75 _PICK_POINT_RADIUS: { value: 10, writable: false }, 75 _PICK_POINT_RADIUS: { value: 4, writable: false },
76 _DISPLAY_ANCHOR_RADIUS: { value: 5, writable: false }, 76 _DISPLAY_ANCHOR_RADIUS: { value: 5, writable: false },
77 _DISPLAY_SELECTED_ANCHOR_RADIUS: { value: 10, writable: false }, 77 _DISPLAY_SELECTED_ANCHOR_RADIUS: { value: 10, writable: false },
78 _DISPLAY_SELECTED_ANCHOR_PREV_RADIUS: { value: 2, writable: false }, 78 _DISPLAY_SELECTED_ANCHOR_PREV_RADIUS: { value: 2, writable: false },
@@ -279,7 +279,8 @@ exports.PenTool = Montage.create(ShapeTool, {
279 this._hoveredAnchorIndex = -1; 279 this._hoveredAnchorIndex = -1;
280 280
281 //set the cursor to be the default cursor 281 //set the cursor to be the default cursor
282 this.application.ninja.stage.drawingCanvas.style.cursor = "auto"; 282 this.application.ninja.stage.drawingCanvas.style.cursor = //"auto";
283 "url('images/cursors/penCursors/Pen_newPath.png') 0 0, default";
283 284
284 if (this._isDrawing) { 285 if (this._isDrawing) {
285 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); 286 var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY));
@@ -351,14 +352,25 @@ exports.PenTool = Montage.create(ShapeTool, {
351 var selAnchorRetCode = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); 352 var selAnchorRetCode = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS);
352 if (selAnchorRetCode[0] >=0) { 353 if (selAnchorRetCode[0] >=0) {
353 this._hoveredAnchorIndex = selAnchorRetCode[0]; 354 this._hoveredAnchorIndex = selAnchorRetCode[0];
355 var lastAnchorIndex = this._selectedSubpath.getNumAnchors()-1;
354 var cursor = "url('images/cursors/penCursors/Pen_anchorSelect.png') 0 0, default"; 356 var cursor = "url('images/cursors/penCursors/Pen_anchorSelect.png') 0 0, default";
357 if (this._selectedSubpath.getIsClosed()===false){
358 if (this._entryEditMode === this.ENTRY_SELECT_PATH && !this._isPickedEndPointInSelectPathMode && (this._hoveredAnchorIndex===0 || this._hoveredAnchorIndex===lastAnchorIndex)){
359 //if we're in SELECT_PATH mode, have not yet clicked on the end anchors, AND we hovered over one of the end anchors
360 cursor = "url('images/cursors/penCursors/Pen_append.png') 0 0, default";
361 } else if ( this._selectedSubpath.getSelectedAnchorIndex()===lastAnchorIndex && this._hoveredAnchorIndex===0) {
362 //if we've selected the last anchor and hover over the first anchor
363 cursor = "url('images/cursors/penCursors/Pen_closePath.png') 0 0, default";
364 }
365 } //if path is not closed
355 this.application.ninja.stage.drawingCanvas.style.cursor = cursor; 366 this.application.ninja.stage.drawingCanvas.style.cursor = cursor;
356 } else { 367 } else {
357 //detect if the current mouse position will hit the path 368 //detect if the current mouse position will hit the path (such that clicking here will insert a new anchor)
358 var pathHitTestData = this._selectedSubpath.pathHitTest(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); 369 var pathHitTestData = this._selectedSubpath.pathHitTest(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS*0.5);
359 if (pathHitTestData[0]!==-1){ 370 if (pathHitTestData[0]!==-1){
360 //change the cursor 371 //change the cursor
361 372 var cursor = "url('images/cursors/penCursors/Pen_plus.png') 0 0, default";
373 this.application.ninja.stage.drawingCanvas.style.cursor = cursor;
362 } 374 }
363 } 375 }
364 } 376 }