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

reordering

This commit is contained in:
Pomax
2020-08-12 22:27:57 -07:00
parent 6498341566
commit 60f24a5d1f
20 changed files with 661 additions and 380 deletions

View File

@@ -2,6 +2,7 @@ import { enrich } from "../lib/enrich.js";
import { Bezier } from "./types/bezier.js";
import { Vector } from "./types/vector.js";
import { Shape } from "./util/shape.js";
import { Matrix } from "./util/matrix.js";
import { BaseAPI } from "./base-api.js";
const MOUSE_PRECISION_ZONE = 5;
@@ -103,6 +104,11 @@ class GraphicsAPI extends BaseAPI {
this.currentPoint = undefined;
}
resetMovable(points) {
this.moveable.splice(0, this.moveable.length);
if (points) this.setMovable(points);
}
setMovable(points) {
points.forEach((p) => this.moveable.push(p));
}
@@ -479,6 +485,10 @@ class GraphicsAPI extends BaseAPI {
return Math.round(v);
}
random(v = 1) {
return Math.random() * v;
}
abs(v) {
return Math.abs(v);
}
@@ -517,4 +527,4 @@ class GraphicsAPI extends BaseAPI {
}
}
export { GraphicsAPI, Bezier, Vector };
export { GraphicsAPI, Bezier, Vector, Matrix };