diff --git a/index.html b/index.html
index c8079a0..b24c583 100644
--- a/index.html
+++ b/index.html
@@ -28,7 +28,7 @@
-
+
diff --git a/styles.css b/styles.css
index 0c556db..68957a4 100644
--- a/styles.css
+++ b/styles.css
@@ -260,7 +260,9 @@ h1 { margin: 0; max-width: 11ch; font-size: clamp(44px, 5.4vw, 80px); line-heigh
.tool-x { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); align-items: center; gap: 48px; }
.tool-x-stack { display: grid; justify-items: center; gap: 8px; }
.tool-x-tower { position: relative; width: 340px; height: 220px; margin: 170px 0 90px; transform-style: preserve-3d; transform: perspective(2000px) rotateX(58deg) rotateZ(-38deg); }
-.tool-x-pane { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--line)); border-radius: 2px; background: color-mix(in srgb, var(--background) 82%, transparent); color: var(--muted); cursor: pointer; transform: translateZ(calc(var(--i) * 58px)); transition: transform .45s cubic-bezier(.2, .7, .2, 1), background-color .3s ease, box-shadow .3s ease, color .3s ease; box-shadow: 0 30px 50px -30px rgb(0 0 0 / .25); }
+.tool-x-pane { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--line)); border-radius: 2px; background: color-mix(in srgb, var(--background) 82%, transparent); color: var(--muted); pointer-events: none; transform: translateZ(calc(var(--i) * 58px)); transition: transform .45s cubic-bezier(.2, .7, .2, 1), background-color .3s ease, box-shadow .3s ease, color .3s ease; box-shadow: 0 30px 50px -30px rgb(0 0 0 / .25); }
+/* The panes' fixed twins (tools.js): transparent, never lifted, and the only part that takes the pointer. */
+.tool-x-hit { position: absolute; inset: 0; cursor: pointer; transform: translateZ(calc(var(--i) * 58px)); }
.tool-x-pane::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 45%, transparent) 1px, transparent 1.6px) 0 0 / 9px 9px; opacity: .35; pointer-events: none; transition: opacity .3s ease; }
.tool-x-pane.is-active { color: var(--ink); background: color-mix(in srgb, var(--accent) 10%, var(--background)); transform: translateZ(calc(var(--i) * 58px + 34px)); box-shadow: 0 0 0 1px var(--accent), 0 40px 60px -30px color-mix(in srgb, var(--accent) 60%, transparent); }
.tool-x-pane.is-active::after { opacity: .7; }
diff --git a/tools.js b/tools.js
index 2936e6a..aef5dee 100644
--- a/tools.js
+++ b/tools.js
@@ -4,6 +4,7 @@
(() => {
const TOWER = ['sqlload', 'sqltide', 'sqlbuild', 'sqlbabel', 'fensu', 'sqlclean']; // bottom to top
const CYCLE_MS = 4500;
+ const DWELL_MS = 120; // how long the pointer stays on a pane before it takes over
function init(section) {
const grid = section.querySelector('.tool-grid');
@@ -39,24 +40,33 @@
const tower = document.createElement('div');
tower.className = 'tool-x-tower';
tower.setAttribute('aria-hidden', 'true');
+ // Each pane has an invisible twin that never lifts and takes the pointer, so lifting a pane
+ // can't change which one is under it; otherwise the edge between two panes flickers.
+ const hits = [];
const panes = TOWER.map((key, i) => {
const tool = byKey(key);
const pane = document.createElement('div');
pane.className = `tool-x-pane ${key}`;
pane.style.setProperty('--i', i);
+ const hit = document.createElement('div');
+ hit.className = 'tool-x-hit';
+ hit.dataset.pane = key;
+ hit.style.setProperty('--i', i);
+ hit.addEventListener('pointermove', (event) => {
+ if (event.pointerType === 'mouse' && moved) aim(key, event);
+ });
+ hit.addEventListener('click', () => pick(key, true));
+ hits.push(hit);
const name = document.createElement('span');
name.className = 'tool-x-name';
name.append(...logos(tool), tool.name);
const mini = tool.article.querySelector('.terminal').cloneNode(true);
mini.className = 'tool-x-mini';
pane.append(name, mini);
- pane.addEventListener('pointermove', (event) => {
- if (event.pointerType === 'mouse' && moved) pick(key, true);
- });
- pane.addEventListener('click', () => pick(key, true));
tower.append(pane);
return pane;
});
+ tower.append(...hits);
const chips = document.createElement('div');
chips.className = 'tool-x-chips';
chips.setAttribute('role', 'group');
@@ -79,6 +89,60 @@
let current = null;
let timer = null;
let visible = false;
+
+ // Hover picks a pane once the pointer has stayed on it for DWELL_MS, and not while the pointer
+ // is heading for the card, so moving across to the card doesn't switch tools on the way.
+ let candidate = null;
+ let since = 0;
+ let dwell = null;
+ let from = null; // where the pointer was a moment ago, to tell which way it is going
+ function headingForCard(x, y) {
+ if (!from) return false;
+ const dx = x - from.x;
+ const dy = y - from.y;
+ if (Math.hypot(dx, dy) < 2) return false;
+ const card = grid.getBoundingClientRect();
+ // Does the ray from `from` through (x, y) reach the card?
+ let near = 0;
+ let far = Infinity;
+ for (const [d, p, lo, hi] of [[dx, from.x, card.left, card.right], [dy, from.y, card.top, card.bottom]]) {
+ if (d === 0) {
+ if (p < lo || p > hi) return false;
+ continue;
+ }
+ const a = (lo - p) / d;
+ const b = (hi - p) / d;
+ near = Math.max(near, Math.min(a, b));
+ far = Math.min(far, Math.max(a, b));
+ }
+ return near <= far;
+ }
+ function aim(key, event) {
+ const now = performance.now();
+ if (key !== candidate) {
+ candidate = key;
+ since = now;
+ }
+ const heading = headingForCard(event.clientX, event.clientY);
+ if (!from || now - from.t > 40) from = { x: event.clientX, y: event.clientY, t: now };
+ clearTimeout(dwell);
+ if (candidate === current) return;
+ const due = Math.max(0, since + DWELL_MS - now);
+ if (!heading && due === 0) {
+ pick(candidate, true);
+ return;
+ }
+ // Check again shortly: by then the pointer has either stopped here or moved on.
+ dwell = setTimeout(() => {
+ from = null;
+ if (candidate && document.elementFromPoint(lastX, lastY)?.dataset.pane === candidate) pick(candidate, true);
+ }, heading ? DWELL_MS * 2 : due);
+ }
+ tower.addEventListener('pointerleave', () => {
+ clearTimeout(dwell);
+ candidate = null;
+ from = null;
+ });
function pick(key, byPerson) {
if (byPerson) stopCycle();
if (key === current) return;
@@ -91,8 +155,9 @@
clearInterval(timer);
timer = 'stopped';
}
- // Until someone picks a tool, show each in turn while the section is on screen.
- if (!reduced.matches) {
+ // Until someone picks a tool, show each in turn while the section is on screen. Not on a phone,
+ // where the card sits below the stack at its own height, so cycling would move the page.
+ if (!reduced.matches && !matchMedia('(max-width: 620px)').matches) {
timer = setInterval(() => {
if (!visible || document.hidden) return;
const at = tools.findIndex((tool) => tool.key === current);