mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-08 20:48:12 +08:00
Bezier-rs: add Tangents/Normals to Point functions (#1547)
* Add tangent/normal to point to bézier-rs * Add license information and general cleanup * Bump version * Add iframe demos --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
c14c6fbe93
commit
6a10bcc3fc
@@ -39,6 +39,9 @@ class BezierDemo extends HTMLElement implements Demo {
|
||||
|
||||
sliderUnits!: Record<string, string | string[]>;
|
||||
|
||||
// Avoids "recursive use of an object detected which would lead to unsafe aliasing in rust" error when moving mouse fast.
|
||||
locked!: boolean;
|
||||
|
||||
async connectedCallback() {
|
||||
this.title = this.getAttribute("title") || "";
|
||||
this.points = JSON.parse(this.getAttribute("points") || "[]");
|
||||
@@ -85,6 +88,8 @@ class BezierDemo extends HTMLElement implements Demo {
|
||||
}
|
||||
|
||||
onMouseMove(event: MouseEvent) {
|
||||
if (this.locked) return;
|
||||
this.locked = true;
|
||||
const mx = event.offsetX;
|
||||
const my = event.offsetY;
|
||||
const figure = event.currentTarget as HTMLElement;
|
||||
@@ -96,6 +101,7 @@ class BezierDemo extends HTMLElement implements Demo {
|
||||
} else if (this.triggerOnMouseMove) {
|
||||
this.drawDemo(figure, [mx, my]);
|
||||
}
|
||||
this.locked = false;
|
||||
}
|
||||
|
||||
getSliderUnit(sliderValue: number, variable: string): string {
|
||||
|
||||
Reference in New Issue
Block a user