From 7e778c17d8be752ebe376092371afdc5b94f42c7 Mon Sep 17 00:00:00 2001 From: "Craig C." Date: Fri, 13 Nov 2026 12:04:04 +0200 Subject: [PATCH] fix(site): keep Huginn's drift inside the page Each pane drifts 10px back along his line as he brushes it in. Since he can head left, that drift pushes it right, and the header is full width, so it went past the right edge and added a horizontal scrollbar while it played. With classic scrollbars (in an iframe, for one) that took height from the viewport and added a vertical one too. The drift is now held inside the page's right and bottom edges. The sweep still runs his way; only the pixels the pane moves are limited. Fixes #25 --- apps/site/src/components/Aurora.astro | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/site/src/components/Aurora.astro b/apps/site/src/components/Aurora.astro index b442e84..5473efa 100644 --- a/apps/site/src/components/Aurora.astro +++ b/apps/site/src/components/Aurora.astro @@ -280,8 +280,16 @@ import "@northguild/theme/tokens-aurora.css"; "--ng-to", `${50 - (50 * dx) / k}% ${50 - (50 * dy) / k}%`, ); - el.style.setProperty("--ng-dx", dx.toFixed(3)); - el.style.setProperty("--ng-dy", dy.toFixed(3)); + // The drift (10px back along his line, Base.astro) stays inside the + // page's right and bottom edges: past them it adds a scrollbar while it + // plays. The header is full width, so heading left it drifts only + // up or down. + const root = document.documentElement; + const r = el.getBoundingClientRect(); + const roomX = Math.max(0, root.clientWidth - r.right) / 10; + const roomY = Math.max(0, root.scrollHeight - scrollY - r.bottom) / 10; + el.style.setProperty("--ng-dx", Math.max(dx, -roomX).toFixed(3)); + el.style.setProperty("--ng-dy", Math.max(dy, -roomY).toFixed(3)); el.style.setProperty("--ng-brush-duration", `${duration}s`); el.classList.add("ng-brushed"); }