From bb1b9f596596d7e427ec07331e36949ccd86273e Mon Sep 17 00:00:00 2001 From: Orion Reed Date: Tue, 3 Dec 2024 00:48:25 -0500 Subject: [PATCH] use lerp for center --- src/folk-shape.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/folk-shape.ts b/src/folk-shape.ts index 36c4ab1..0d4f5b7 100644 --- a/src/folk-shape.ts +++ b/src/folk-shape.ts @@ -414,10 +414,8 @@ export class FolkShape extends HTMLElement { const [topLeft] = this.getClientRect().corners(); - const newCenter: Point = { - x: (topLeft.x + clientX) / 2, - y: (topLeft.y + clientY) / 2, - }; + const newCenter: Point = Vector.lerp(topLeft, { x: clientX, y: clientY }, 0.5); + const newTopLeft = Vector.rotateAround(topLeft, newCenter, -this.rotation); let bottomRight: Point;