Comments (7)
Hey @letalboy
there is no "on:connect" handler, but an "onconnect" (and also "onconnectstart" and "onconnectend"). Svelte Flow creates edges automatically for you. As Peter pointed out there is no need to do it on your own. However, you can use the onconnect
handler or the onedgecreate
handler if you want to adjust the id.
Svelte Flow adds new edges to the edges
writable as you can see in the onconnectend
handler: https://stackblitz.com/edit/svelte-flow-ts-pbp7xu?file=src/Flow/index.svelte
Does this solve your issue?
from xyflow.
I am glad you could solve it :)
from xyflow.
You don't need to apply any updates in Svelte Flow by hand. That is only required in React Flow.
on:connect will notify you when a user has connected two handles successfully.
If you create a stackblitz with your code I can help you out.
from xyflow.
Hello @peterkogo thanks for the speed in reply! I've created the stackblitz with all the required code to the graph page, exactly how I'm trying to do here. Here is the link for the code, let me know if you are able to access t, I never had used stackblitz before so I don't know if I configured it correctly...
from xyflow.
I also forget to mention that I don't have the stackblitz plan, so I don't know if I can add you to the project, in the case that you can't modify it directly you don't need to wait, simple to a fork, since you already know how to use the platform it will be more simple, then we continue here to solve this particular thing, if possible. Let me know if you need something else in the svelte setup ;)
from xyflow.
Hey @peterkogo, got any updates? I just need to know how to capture new links when a user connects nodes. I know we can use an approximation similar to the 'node approximation connection' example in the Svelte docs, but I need something to trigger a function to save a new connection or to auto-sync with the variable when changes occur in the graph. I've got 2 projects depending on this that I'm kinda late to finish, and I can't find a clear explanation in Svelte in any place. If you know how, could you use the source code I uploaded on StackBlitz? Feel free to fork it and implement a basic example, or just explain how it works in Svelte, you know just a simple example nothing too elaborated, just a simple example of a node edge update using callbacks or a reference link intenally. That would be super helpful and would allow me to continue with the Svelte implementation of the graph that i'm kinda. Without this functionality, I might have to switch everything to React, which has better documentation for this. Any feedback you can provide would be greatly appreciated. I'm waiting for any updates.
from xyflow.
Thanks @moklick this does exactly what I want. I saw this method before but think it will not work because of the missing :
standard of the on:connect
and other events notation in svelt but I copied what you uploaded in the Stackblitz to my code here, and it does exactly what I was looking for. This completely solves my issue. Thank you!
from xyflow.
Related Issues (20)
- SvelteFlow: Attach an edge to an edge HOT 12
- `nodesConnectable` prop doesn't seem to be reactive to value changes
- CSS: Selected node looks the same as focused node HOT 2
- Dockerfile and Docker compose integrations HOT 2
- onlyRenderVisibleElements with width and height set on node doesn't render edge if one of the nodes is offscreen HOT 2
- Promote handleLookup to be persistent in the store
- React Flow - Maximum update depth exceeded when moving nodes around HOT 3
- getConnectedEdges returns a list of edges that connect nodes but not with each other as mentioned in docs HOT 2
- Custom Node Mouse Event Flickering in ReactFlow HOT 8
- [v12] Edge renderer size not expanding to fit the viewport HOT 4
- Click on the canvas blank area to trigger mackdown to rearrange and calculate styles HOT 2
- v11 --> v12 breaks edge position and placement when loading images HOT 27
- Different behaviour between coordinate extent and parent extent
- The Select or Dropdowns don't get triggered when using React Library HOT 3
- auto adjust the viewport when i pass the position of one node to setViewPort,but it work not good HOT 2
- `Handle` type isn't exported correctly anymore. HOT 10
- Edges do not render initially, 'Couldn't create edge for source handle id: "null"' when using ELK HOT 10
- [Feature]: Add `XYFlowError` that provides error arguments and allows for easier discerning of errors HOT 1
- Dynamically handle scrolling HOT 1
- Add a way to handle invalid/incomplete connections in a callback.
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 xyflow.