Skip to content

How to detect if node is inside viewport? #1616

Answered by bcakmakoglu
826327700 asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the getNodesInside utility that is exported by @vue-flow/core

const nodes = ref([...])

const { viewport } = useVueFlow()

const nodesInViewport = getNodesInside(
      	nodes.value,
        {
          x: 0,
          y: 0,
          width: state.dimensions.width,
          height: state.dimensions.height,
        },
       viewport.value,
      )

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bcakmakoglu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants