Zoom to newly added entity in graph editor instead of just panning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 17:49:34 +03:00
parent 5c7c2ad1b2
commit 844866b489

View File

@@ -280,10 +280,16 @@ function _watchForNewEntity() {
if (!Array.isArray(data)) return;
for (const item of data) {
if (item.id && !knownIds.has(item.id)) {
// Found a new entity — reload graph and navigate to it
// Found a new entity — reload graph and zoom to it
const newId = item.id;
cleanup();
loadGraphEditor().then(() => _navigateToNode(newId));
loadGraphEditor().then(() => {
const node = _nodeMap?.get(newId);
if (node && _canvas) {
_canvas.zoomToPoint(1.5, node.x + node.width / 2, node.y + node.height / 2);
}
_navigateToNode(newId);
});
return;
}
}