MCPcopy Create free account
hub / github.com/microsoft/SandDance / pickLine

Function pickLine

docs/app/js/sanddance-app.js:122452–122462  ·  view source on GitHub ↗
(a, p)

Source from the content-addressed store, hash-verified

122450 return hit2;
122451}
122452function pickLine(a, p) {
122453 var t = Math.pow(a[0].strokeWidth || 1, 2), i = a.length, dx, dy, dd;
122454 while(--i >= 0){
122455 if (a[i].defined === false) continue;
122456 dx = a[i].x - p[0];
122457 dy = a[i].y - p[1];
122458 dd = dx * dx + dy * dy;
122459 if (dd < t) return a[i];
122460 }
122461 return null;
122462}
122463function pickTrail(a, p) {
122464 var i = a.length, dx, dy, dd;
122465 while(--i >= 0){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected