fix(hub): no nav after drag, single loop entry
This commit is contained in:
+12
-3
@@ -104,8 +104,17 @@ export function mountAtomHub(mount: HTMLElement, data: HubData): void {
|
||||
tip.style.left = `${ev.clientX - r.left + 14}px`;
|
||||
tip.style.top = `${ev.clientY - r.top + 14}px`;
|
||||
});
|
||||
renderer.domElement.addEventListener('click', () => {
|
||||
if (hovered) location.href = (hovered.userData as { url: string }).url;
|
||||
let pointerDownPos = { x: 0, y: 0 };
|
||||
renderer.domElement.addEventListener('pointerdown', (ev) => {
|
||||
pointerDownPos = { x: ev.clientX, y: ev.clientY };
|
||||
});
|
||||
renderer.domElement.addEventListener('click', (ev) => {
|
||||
const dx = ev.clientX - pointerDownPos.x;
|
||||
const dy = ev.clientY - pointerDownPos.y;
|
||||
// ignore clicks that end a rotation drag (>5px displacement)
|
||||
if (hovered && dx * dx + dy * dy < 25) {
|
||||
location.href = (hovered.userData as { url: string }).url;
|
||||
}
|
||||
});
|
||||
|
||||
let raf = 0;
|
||||
@@ -160,7 +169,7 @@ export function mountAtomHub(mount: HTMLElement, data: HubData): void {
|
||||
labels.setSize(w, H);
|
||||
});
|
||||
|
||||
frame();
|
||||
// loop started by the IntersectionObserver callback (single entry point)
|
||||
}
|
||||
|
||||
function makeGlowTexture(): THREE.Texture {
|
||||
|
||||
Reference in New Issue
Block a user