1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-09-27 00:29:00 +02:00

curve/curve intersection

This commit is contained in:
Pomax
2020-08-29 12:49:23 -07:00
parent bdc7c4228d
commit f4eafa288a
10 changed files with 235 additions and 163 deletions

View File

@@ -123,15 +123,29 @@ class GraphicsAPI extends BaseAPI {
this.currentPoint = false;
}
resetMovable(points) {
resetMovable(...allpoints) {
this.movable.splice(0, this.movable.length);
if (points) this.setMovable(points);
if (allpoints) this.setMovable(...allpoints);
}
setMovable(...allpoints) {
allpoints.forEach((points) => points.forEach((p) => this.movable.push(p)));
}
/**
* Multi-panel graphics: set panel count
*/
setPanelCount(c) {
this.panelWidth = this.width / c;
}
/**
* Multi-panel graphics: set up (0,0) to the next panel's start
*/
nextPanel(c) {
this.translate(this.panelWidth, 0);
}
/**
* Set up a slider to control a named, numerical property in the sketch.
*
@@ -156,11 +170,13 @@ class GraphicsAPI extends BaseAPI {
slider.value = initial;
this[propname] = parseFloat(slider.value);
let handlerName = `on${propname[0].toUpperCase()}${propname
.substring(1)
.toLowerCase()}`;
slider.listen(`input`, (evt) => {
this[propname] = parseFloat(evt.target.value);
if (redraw && !this.redrawing) {
this.redraw();
}
if (this[handlerName]) this[handlerName](this[propname]);
if (redraw && !this.redrawing) this.redraw();
});
return slider;