1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-25 17:42:46 +02:00

arc length

This commit is contained in:
Pomax
2020-08-25 18:38:38 -07:00
parent 22ffc4b6c2
commit bf88ba4e4c
43 changed files with 23663 additions and 5474 deletions

View File

@@ -68,6 +68,7 @@ class BaseAPI {
this.HATCHING = hatch(canvasBuildFunction);
this.addListeners();
this.setSize(width, height);
this.currentPoint = false;
this.setup();
this.draw();
}
@@ -91,7 +92,17 @@ class BaseAPI {
);
[`touchmove`, `mousemove`].forEach((evtName) =>
canvas.addEventListener(evtName, (evt) => this.onMouseMove(evt))
canvas.addEventListener(evtName, (evt) => {
this.onMouseMove(evt);
// Force a redraw only if there are movable points,
// and there is a current point bound, but only if
// the subclass didn't already call redraw() as part
// of its own mouseMove handling.
if (this.movable.length && this.currentPoint && !this.redrawing) {
this.redraw();
this.redrawing = false;
}
})
);
[`touchend`, `mouseup`].forEach((evtName) =>
@@ -243,6 +254,7 @@ class BaseAPI {
* disappear.
*/
redraw() {
this.redrawing = true;
this.draw();
}
}

View File

@@ -126,7 +126,7 @@ class GraphicsAPI extends BaseAPI {
onMouseUp(evt) {
super.onMouseUp(evt);
this.currentPoint = undefined;
this.currentPoint = false;
}
resetMovable(points) {