diff options
author | Pushkar Joshi | 2012-01-31 12:05:15 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-01-31 12:05:15 -0800 |
commit | f0e3fa691b3c042c9fc49a7a0cde8ddf8100c195 (patch) | |
tree | 182d61721570e49a304894d54f0f451077770ee9 /js/helper-classes | |
parent | 972e0ce4df7b332601ad006ca8b7dd9e189a59ef (diff) | |
download | ninja-f0e3fa691b3c042c9fc49a7a0cde8ddf8100c195.tar.gz |
display the anchor point to be selected on mouse hover
Diffstat (limited to 'js/helper-classes')
-rw-r--r-- | js/helper-classes/RDGE/GLSubpath.js | 17 |
1 files changed, 17 insertions, 0 deletions
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() { | |||
363 | return true; | 363 | return true; |
364 | } | 364 | } |
365 | 365 | ||
366 | this.pickAnchor = function (pickX, pickY, pickZ, radius) { | ||
367 | var numAnchors = this._Anchors.length; | ||
368 | var selAnchorIndex = -1; | ||
369 | var retCode = this.SEL_NONE; | ||
370 | var radSq = radius * radius; | ||
371 | var minDistance = Infinity; | ||
372 | for (var i = 0; i < numAnchors; i++) { | ||
373 | var distSq = this._Anchors[i].getDistanceSq(pickX, pickY, pickZ); | ||
374 | //check the anchor point | ||
375 | if (distSq < minDistance && distSq < radSq) { | ||
376 | selAnchorIndex = i; | ||
377 | minDistance = distSq; | ||
378 | } | ||
379 | }//for every anchor i | ||
380 | return selAnchorIndex; | ||
381 | } | ||
382 | |||
366 | //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 | 383 | //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 |
367 | this.pickPath = function (pickX, pickY, pickZ, radius) { | 384 | this.pickPath = function (pickX, pickY, pickZ, radius) { |
368 | var numAnchors = this._Anchors.length; | 385 | var numAnchors = this._Anchors.length; |