Comments (3)
Two things, both aren't a bug here.
- If you wanna have a an edge that just connects to the same node, you'll have to use a custom edge and adjust the path, otherwise the edge will run through the node - default edges aren't meant for self-loops.
- If you update the position of your handles, you need to notify your node about this. This is documented right here: https://vueflow.dev/guide/node.html#working-with-dynamic-handle-positions-adding-handles-dynamically
So in your case
const onChange = () => {
const node: any = nodes.value.find((n) => n.selected)
if (!node) return
node.targetPosition = node.targetPosition === 'left' ? 'top' : 'left'
node.sourcePosition = node.sourcePosition === 'right' ? 'bottom' : 'right'
setTimeout(() => {
updateNodeInternals(['1'])
}, 0)
}
Here's an example: https://codesandbox.io/p/devbox/sleepy-ritchie-p4yn9m?file=%2Fsrc%2FApp.vue%3A36%2C1-38%2C8
from vue-flow.
Thank you, boss.
from vue-flow.
This is a ReactFlow example for a self-connecting node but you can use the same concept for VueFlow: https://codesandbox.io/p/sandbox/sharp-orla-vyjqen
from vue-flow.
Related Issues (20)
- 🐛 [BUG]: Strange edge behaviour for type 'smoothstep' and 'step' HOT 2
- 🐛 [BUG]: multi-selection-key-code property error HOT 4
- 🐛 [BUG]: Background lines mode is invalid HOT 2
- 🐛 [BUG]: <title> vue-flow is not hack with uniapp-h5-vue HOT 3
- 🐛 [BUG]: [Vue warn]: Invalid prop name: "ref" is a reserved property. HOT 2
- 🐛 [BUG]: some event Types are missing (nodeClick, nodeDoubleClick, ...) HOT 6
- 🐛 [BUG]: Register a custom component for repeated rendering HOT 2
- 🐛 [BUG]: Nuxt3 Hydration attribute mismatch HOT 9
- 🐛 [BUG]: Node added in `onMounted()` is not rendered HOT 2
- 🐛 [BUG]: Canvas captures scroll even when all scroll-related features are disabled HOT 16
- 🐛 [BUG]: useNodesData is not available in "@vue-flow/core" library, but is refernced in the documentaion, and also in examples
- 🐛 [BUG]: Devtool throws warning when using node resizer HOT 2
- 🐛 [BUG]: `pathOptions` for default edges aren't applied HOT 1
- 🐛 [BUG]: flickering on some phone browsers HOT 4
- 🐛 [BUG]: Wrong edge position with dynamic handle id HOT 5
- 🐛 [BUG]: When typing, CMD + Backspace or Shift + Backspace can delete selected element HOT 1
- 🐛 [BUG]: Docs (vueflow.dev) hangs and never loads on iOS Safari HOT 2
- 🐛 [BUG]: Auto-generated Handle ids change with position HOT 1
- 🐛 [BUG]: <title> manual control <Handle /> graph line confusion HOT 1
- 🐛 [BUG]: manual control <Handle /> graph line confusion HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-flow.