class cPoint { constructor(x, y, kind = 'control') { this.x = x; this.y = y; this.kind = kind; this.r = 9; } set changeX(nx) { this.x = nx; } set changeY(ny) { this.y = ny; } get changeX() { return this.x; } get changeY() { return this.y; } isHit(mx, my, r = HIT_R) { return dist(mx, my, this.x, this.y) <= r; } drawPoint(hovered = false, selected = false, styleOverride = null) { strokeWeight(2); if (styleOverride) { stroke(...styleOverride.stroke); fill(...styleOverride.fill); } else { if (this.kind === 'end') { stroke(0, 220, 90, 240); fill(40, 240, 120, 200); } else if (this.kind === 'control') { stroke(240, 140, 0, 240); fill(255, 180, 40, 200); } else { stroke(140, 160); fill(190, 160); } } if (selected) { stroke(255, 255, 0); strokeWeight(3); } else if (hovered) { stroke(255); } circle(this.x, this.y, this.r * 2); } }