From f0e3fa691b3c042c9fc49a7a0cde8ddf8100c195 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 31 Jan 2012 12:05:15 -0800 Subject: display the anchor point to be selected on mouse hover --- js/helper-classes/RDGE/GLSubpath.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js/helper-classes') diff --git a/js/helper-classes/RDGE/GLSubpath.js b/js/helper-classes/RDGE/GLSubpath.js index 78315e40..2e4c1631 100644 --- a/js/helper-classes/RDGE/GLSubpath.js +++ b/js/helper-classes/RDGE/GLSubpath.js @@ -363,6 +363,23 @@ function GLSubpath() { return true; } + this.pickAnchor = function (pickX, pickY, pickZ, radius) { + var numAnchors = this._Anchors.length; + var selAnchorIndex = -1; + var retCode = this.SEL_NONE; + var radSq = radius * radius; + var minDistance = Infinity; + for (var i = 0; i < numAnchors; i++) { + var distSq = this._Anchors[i].getDistanceSq(pickX, pickY, pickZ); + //check the anchor point + if (distSq < minDistance && distSq < radSq) { + selAnchorIndex = i; + minDistance = distSq; + } + }//for every anchor i + return selAnchorIndex; + } + //pick the path point closest to the specified location, return null if some anchor point (or its handles) is within radius, else return the parameter distance this.pickPath = function (pickX, pickY, pickZ, radius) { var numAnchors = this._Anchors.length; -- cgit v1.2.3