From ac402c29e92dc61acd4ecb365f11dd1611bcf0b7 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sun, 22 Mar 2026 14:28:32 -0700 Subject: [PATCH] feat(canvas): replace repulsion with snap guides + drop suggestion Remove ambient repulsion loop (shapes drifting apart at 60fps). Add Figma-style snap alignment guides during drag with magnetic stickiness, and ghost drop suggestion when shapes overlap after drop. Co-Authored-By: Claude Opus 4.6 --- lib/folk-shape.ts | 1 - website/canvas.html | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/folk-shape.ts b/lib/folk-shape.ts index 10400f5..36c0921 100644 --- a/lib/folk-shape.ts +++ b/lib/folk-shape.ts @@ -296,7 +296,6 @@ export class FolkShape extends FolkElement { this.requestUpdate("rotation"); } - static GAP = 8; // minimum gap between shapes static pushExemptTags = new Set(["folk-arrow", "folk-slide", "folk-shape"]); #highlighted = false; diff --git a/website/canvas.html b/website/canvas.html index e86e3a3..560d955 100644 --- a/website/canvas.html +++ b/website/canvas.html @@ -3971,8 +3971,9 @@ // Keyboard shortcuts for canvas tools document.addEventListener("keydown", (e) => { - // Skip when typing in inputs - if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA" || e.target.isContentEditable) return; + // Skip when typing in inputs (composedPath pierces shadow DOM) + const t = e.composedPath()[0]; + if (t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable) return; if (e.key === "Escape") { // Dismiss reminder widget if open