mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-21 18:47:02 +03:00
Overdrive laser demo, deep link support, and split-compare fix
Demo: - Laser-etched "Paul Bakaus" signature drawn in real-time on dark surface, adapted from pbakaus/shaders laser-precision - Two-canvas architecture: persistent burn canvas + cleared-per-frame spark overlay to prevent pixel accumulation - Smooth quadraticCurveTo rendering for fluid signature strokes - Sparks with motion trails, multi-layer tip glow Infrastructure: - Add init() support for command demos — JS can now execute after demo HTML is inserted into the DOM - Fix split-compare retriggerAnimations to not destroy canvas elements (clone-and-replace for CSS-only demos, individual retrigger when canvas is present) - Add deep linking to commands (#cmd-overdrive etc.) with hash tracking and initial load support - Remove auto-#hero hash — hero is the default state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
8bb0017752
commit
577c9c872c
@@ -22,6 +22,21 @@ export function initHashTracking() {
|
||||
let ticking = false;
|
||||
|
||||
function updateHash() {
|
||||
// Don't override command deep links while user is in the commands section
|
||||
if (currentHash.startsWith('cmd-')) {
|
||||
const cmdEl = document.getElementById(currentHash);
|
||||
if (cmdEl) {
|
||||
const rect = cmdEl.getBoundingClientRect();
|
||||
// Only clear the cmd hash if user scrolled well away from commands section
|
||||
if (rect.top > window.innerHeight * 2 || rect.bottom < -window.innerHeight) {
|
||||
currentHash = '';
|
||||
} else {
|
||||
ticking = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const scrollY = window.scrollY;
|
||||
const viewportHeight = window.innerHeight;
|
||||
const triggerPoint = scrollY + viewportHeight * 0.3;
|
||||
@@ -38,6 +53,9 @@ export function initHashTracking() {
|
||||
}
|
||||
});
|
||||
|
||||
// Don't set #hero — it's the default state, no hash needed
|
||||
if (activeSection === 'hero') activeSection = '';
|
||||
|
||||
if (activeSection !== currentHash) {
|
||||
currentHash = activeSection;
|
||||
if (activeSection) {
|
||||
@@ -59,17 +77,23 @@ export function initHashTracking() {
|
||||
|
||||
// Handle initial hash on page load - instant jump
|
||||
if (window.location.hash) {
|
||||
const target = document.querySelector(window.location.hash);
|
||||
const hash = window.location.hash.slice(1);
|
||||
const target = document.getElementById(hash);
|
||||
if (target) {
|
||||
currentHash = hash;
|
||||
setTimeout(() => {
|
||||
const offset = 40;
|
||||
const targetPosition = target.getBoundingClientRect().top + window.scrollY - offset;
|
||||
window.scrollTo({ top: targetPosition, behavior: 'auto' });
|
||||
|
||||
// If it's a command deep link, activate it
|
||||
if (hash.startsWith('cmd-') && target.classList.contains('manual-entry')) {
|
||||
target.click();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
} else {
|
||||
// No hash — don't set one on initial load
|
||||
}
|
||||
|
||||
// Initial check
|
||||
updateHash();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user