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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user