Eyes banner follows taps not just mouse.

This commit is contained in:
2026-08-24 20:54:50 +00:00
parent c5cf799f68
commit b1fc8e24d7
2 changed files with 21 additions and 6 deletions
+2 -2
View File
@@ -946,7 +946,7 @@ article h2 {
/* Smaller type: the horizontal link strip fits roughly a third more
items per line. The nested-list gaps below are em-based and shrink
along. */
font-size: 0.9rem;
font-size: 0.8rem;
}
/* Only the main level becomes a horizontal wrapping strip; submenus stay
@@ -954,7 +954,7 @@ article h2 {
#sidebar > ul {
flex-direction: row;
flex-wrap: wrap;
gap: 0.35rem 0.9rem;
gap: 0.3rem 0.75rem;
}
figure:has(.right),
+19 -4
View File
@@ -27,15 +27,30 @@
let my = 0
let lastMove = 0
addEventListener('mousemove', e => {
// Mouse and touch tracked with separate listeners (pointer events arrive
// too late on some mobile browsers). Passive listeners: a drag on the
// banner still scrolls the page — on browsers that stop delivering
// touchmove once scrolling takes over, the gaze just follows until then.
const track = (x, y) => {
const r = c.getBoundingClientRect()
// Convert viewport coordinates into the canvas' CSS-pixel coordinate
// system. This remains correct with browser zoom, CSS transforms, etc.
mx = (e.clientX - r.left) * c.clientWidth / r.width
my = (e.clientY - r.top) * c.clientHeight / r.height
mx = (x - r.left) * c.clientWidth / r.width
my = (y - r.top) * c.clientHeight / r.height
lastMove = performance.now()
})
}
addEventListener('mousemove', e => track(e.clientX, e.clientY))
const trackTouch = e => {
const t = e.touches[0]
if (t) track(t.clientX, t.clientY)
}
addEventListener('touchstart', trackTouch, { passive: true })
addEventListener('touchmove', trackTouch, { passive: true })
let gx = 0.5
let gy = 0.5