Fix zoomToPoint animation to smoothly fly-to target node

Interpolate both view center and zoom level together using rAF
instead of CSS transitions, so the target node smoothly slides
to screen center while zooming in simultaneously.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 18:06:05 +03:00
parent 844866b489
commit e163575bac
2 changed files with 50 additions and 8 deletions

View File

@@ -286,9 +286,14 @@ function _watchForNewEntity() {
loadGraphEditor().then(() => {
const node = _nodeMap?.get(newId);
if (node && _canvas) {
// Animate zoom + pan together in one transition
_canvas.zoomToPoint(1.5, node.x + node.width / 2, node.y + node.height / 2);
}
_navigateToNode(newId);
// Highlight the node and its chain (without re-panning)
const nodeGroup = document.querySelector('.graph-nodes');
if (nodeGroup) { highlightNode(nodeGroup, newId); setTimeout(() => highlightNode(nodeGroup, null), 3000); }
const edgeGroup = document.querySelector('.graph-edges');
if (edgeGroup && _edges) { highlightChain(edgeGroup, newId, _edges); setTimeout(() => clearEdgeHighlights(edgeGroup), 5000); }
});
return;
}