How can I scroll a node in to view area? #487
Answered
by
bcakmakoglu
amjadaliup
asked this question in
Q&A
-
|
I need to highlight a node on clicking a button. So I need to scroll a node in to view and then I can highlight the specific node by adding a class. But I don't know how can I scroll to a node or scroll to a specific position programically. |
Beta Was this translation helpful? Give feedback.
Answered by
bcakmakoglu
Dec 6, 2022
Replies: 1 comment 2 replies
-
|
Simplest way to do this is using the const { fitView } = useVueFlow()
const onClick = () => {
fitView({ padding: 1, nodes: ['1'] })
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
amjadaliup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simplest way to do this is using the
fitViewaction.The
fitViewaction accepts an array of node ids that it's supposed to fit around.