Skip to content

MoveTo node #1242

Closed Answered by bcakmakoglu
skadefro asked this question in Q&A
Jan 15, 2024 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

The simplest way to do this is to use fitView

const { fitView } = useVueFlow();

function zoomToNode(nodeId: string) {
	fitView({
		nodes: [nodeId],
		duration: 1000, // use this if you want a smooth transition to the node
		padding: 1 // use this for some padding around the node
	})
}

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by skadefro
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@bcakmakoglu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants