1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-09-25 15:49:06 +02:00

pointvectors

This commit is contained in:
Pomax
2020-08-13 17:16:46 -07:00
parent 8a939335ca
commit f7ec7fa90a
14 changed files with 242 additions and 42 deletions

View File

@@ -72,8 +72,8 @@ class GraphicsAPI extends BaseAPI {
? TOUCH_PRECISION_ZONE
: MOUSE_PRECISION_ZONE;
for (let i = 0, e = this.moveable.length, p, d; i < e; i++) {
p = this.moveable[i];
for (let i = 0, e = this.movable.length, p, d; i < e; i++) {
p = this.movable[i];
d = new Vector(p).dist(this.cursor);
if (d <= cdist) {
this.currentPoint = p;
@@ -88,8 +88,8 @@ class GraphicsAPI extends BaseAPI {
this.currentPoint.x = this.cursor.x;
this.currentPoint.y = this.cursor.y;
} else {
for (let i = 0, e = this.moveable.length, p; i < e; i++) {
p = this.moveable[i];
for (let i = 0, e = this.movable.length, p; i < e; i++) {
p = this.movable[i];
if (new Vector(p).dist(this.cursor) <= 5) {
this.setCursor(this.HAND);
return; // NOTE: this is a return, not a break.
@@ -105,12 +105,12 @@ class GraphicsAPI extends BaseAPI {
}
resetMovable(points) {
this.moveable.splice(0, this.moveable.length);
this.movable.splice(0, this.movable.length);
if (points) this.setMovable(points);
}
setMovable(points) {
points.forEach((p) => this.moveable.push(p));
points.forEach((p) => this.movable.push(p));
}
/**