feat(editor): Zoom in to node after creation (no-changelog) (#17617)

This commit is contained in:
Suguru Inoue
2025-07-25 12:36:09 +02:00
committed by GitHub
parent 4f01bd1ecf
commit 408ccd2a58
3 changed files with 38 additions and 1 deletions

View File

@@ -862,6 +862,26 @@ watch([nodesSelectionActive, userSelectionRect], ([isActive, rect]) =>
emit('update:has-range-selection', isActive || (rect?.width ?? 0) > 0 || (rect?.height ?? 0) > 0),
);
watch([vueFlow.nodes, () => experimentalNdvStore.nodeNameToBeFocused], ([nodes, toFocusName]) => {
const toFocusNode =
toFocusName &&
(nodes as Array<GraphNode<CanvasNodeData>>).find((n) => n.data.name === toFocusName);
if (!toFocusNode) {
return;
}
// setTimeout() so that this happens after layout recalculation with the node to be focused
setTimeout(() => {
experimentalNdvStore.focusNode(toFocusNode, {
collapseOthers: false,
canvasViewport: viewport.value,
canvasDimensions: dimensions.value,
setCenter,
});
});
});
/**
* Provide
*/