fix(ui): zoom the galaxy toward the cursor

Wheel zoom moved the camera exactly along its view direction for every
cursor position, so the reader could not zoom into the part of the graph
they were pointing at. The Galaxy OrbitControls now use zoomToCursor, which
three-stdlib 2.36 supports and drei passes through. Fits and fly-tos still
set the pivot themselves, and the distance limits apply to the new radius.

Signed-off-by: Bernhard Jackiewicz <bj@techport.io>
This commit is contained in:
Bernhard Jackiewicz
2026-10-02 18:42:48 +02:00
parent e341a4988e
commit 0b03df4c27
+10
View File
@@ -90,6 +90,8 @@
* 15. Neu (Review-Call 2026-10-02): `FitContainment` holt Knoten, die nach
* einer Einpassung dazukommen, ins Bild, indem die Kamera entlang ihrer
* Blickrichtung zuruecktritt, solange der Leser sie nicht bewegt hat.
* 16. Neu (Review-Call 2026-10-02): die OrbitControls zoomen zum Mauszeiger
* (`zoomToCursor`), nicht mehr in die Bildmitte.
*/
import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
@@ -1020,6 +1022,14 @@ export function GraphScene({
dampingFactor={0.08}
rotateSpeed={0.5}
zoomSpeed={1.5}
/*
* Aenderung 16: das Mausrad zoomt dorthin, wo der Zeiger steht,
* und nicht in die Bildmitte (Review-Befund G3). three-stdlib
* versetzt dabei auch den Drehpunkt; die Einpassung und jeder
* Anflug setzen ihn ohnehin selbst, und die Grenzen der
* Entfernung gelten fuer den neuen Abstand genauso.
*/
zoomToCursor
minDistance={Math.max(5, sceneRadius * 0.02)}
maxDistance={Math.max(sceneRadius, orbitReach) * 4}
autoRotateSpeed={0.4}