Coder Social home page Coder Social logo

dynamic handle about xyflow HOT 6 CLOSED

kentaurse avatar kentaurse commented on June 28, 2024
dynamic handle

from xyflow.

Comments (6)

kentaurse avatar kentaurse commented on June 28, 2024

plz check this
https://codesandbox.io/p/sandbox/reactflow-handle-positions-forked-j6lz6k?file=%2Fsrc%2Fcomponents%2FCustomNode.tsx

from xyflow.

peterkogo avatar peterkogo commented on June 28, 2024

If you are updating your handle positions programmatically you have to use updateNodeInternals

We have to redetermine the exact position of the handle every step of the way (in you case on every frame of the transition) to get the correct positions for the edges.

If you just want to have an animated handle, I would suggest you just transform an inner element with position absolute without actually moving the whole container. This way you still achieve the desired effect but the handle positions don't actually ever move.

from xyflow.

kentaurse avatar kentaurse commented on June 28, 2024

thank you

from xyflow.

kentaurse avatar kentaurse commented on June 28, 2024

Could you please help with proximity connection as well?
This works correctly for only one source and target handle.
However, when there are multiple source and target handles, only the first handle works and the rest do not work.

from xyflow.

peterkogo avatar peterkogo commented on June 28, 2024

The code for the proximity connect simply calculates the closest node and then creates a an edge from the source to target handle. If you have multiple handles you need to actually address specific handle ids because there can be more then one source & target handle. You can also determine the closest handle by accessing the handle bounds. Here is an example that also accesses the handle bounds. https://reactflow.dev/examples/edges/multi-connection-line

from xyflow.

kentaurse avatar kentaurse commented on June 28, 2024

thank you

from xyflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.