From 3fd098981077e40841c013a8ac305036d08a215b Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 27 Mar 2012 15:40:37 -0700 Subject: added cursors to the pen tool UI AND change cursor when the user hovers over an anchor point or handles of thte selected anchor --- js/lib/geom/sub-path.js | 51 +++++++++++++++++++++++++++++++------------------ js/tools/PenTool.js | 11 ++++++----- 2 files changed, 38 insertions(+), 24 deletions(-) (limited to 'js') diff --git a/js/lib/geom/sub-path.js b/js/lib/geom/sub-path.js index 7046673e..9bd9ad9a 100755 --- a/js/lib/geom/sub-path.js +++ b/js/lib/geom/sub-path.js @@ -567,37 +567,50 @@ GLSubpath.prototype._isWithinBoundingBox = function(point, ctrlPts, radius) { return true; }; +GLSubpath.prototype._checkAnchorIntersection = function(pickX, pickY, pickZ, radSq, anchorIndex, minDistance) { + var distSq = this._Anchors[anchorIndex].getDistanceSq(pickX, pickY, pickZ); + //check the anchor point + if (distSq < radSq && distSq=0 && this._selectedAnchorIndexx || this._BBoxMin[1]>y || this._BBoxMin[2]>z){ return false; } diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 779b7f16..39a1b15a 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -348,16 +348,17 @@ exports.PenTool = Montage.create(ShapeTool, { var currMousePos = this._getUnsnappedPosition(event.pageX, event.pageY); if (currMousePos && this._selectedSubpath ){ - var selAnchor = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); - if (selAnchor >=0) { - this._hoveredAnchorIndex = selAnchor; + var selAnchorRetCode = this._selectedSubpath.pickAnchor(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); + if (selAnchorRetCode[0] >=0) { + this._hoveredAnchorIndex = selAnchorRetCode[0]; + var cursor = "url('images/cursors/penCursors/Pen_anchorSelect.png') 0 0, default"; + this.application.ninja.stage.drawingCanvas.style.cursor = cursor; } else { //detect if the current mouse position will hit the path var pathHitTestData = this._selectedSubpath.pathHitTest(currMousePos[0], currMousePos[1], currMousePos[2], this._PICK_POINT_RADIUS); if (pathHitTestData[0]!==-1){ //change the cursor - var cursor = "url('images/cursors/penAdd.png') 10 10,default"; - this.application.ninja.stage.drawingCanvas.style.cursor = cursor; + } } } -- cgit v1.2.3