MCPcopy Index your code
hub / github.com/NikLever/ThreeJS-PathEditor / selectNode

Method selectNode

index.js:492–505  ·  view source on GitHub ↗
( x, y )

Source from the content-addressed store, hash-verified

490 }
491
492 selectNode( x, y ){
493 let activeNode = null;
494 const xOrg = this.canvas.width * this.config.yAxis;
495 const scale = (this.canvas.width * 0.95 - xOrg)/ this.config.xMax;
496 const tolerance = (9.0/scale) * (9.0/scale);
497 this.nodes.forEach( node => {
498 const x1 = node.x - x;
499 const y1 = node.y - y;
500 const sqDist = x1*x1 + y1*y1;
501 if (sqDist<tolerance) activeNode = node;
502 });
503 if (activeNode) this.activeCtrl = null;
504 return activeNode;
505 }
506
507 selectCtrl( x, y ){
508 let activeCtrl = null;

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected