Comments (8)
This is already a feature, you can use onSnap which gets triggered when a block can attach to another block, and use the parent parameter + the current block to determine on your end if the blocks can attach or not. Just return false to prevent the attachment.
Let me know if that helps.
from flowy.
Do you mean this function on the demo? function snapping(drag, first)
from flowy.
Do you mean this function on the demo? function snapping(drag, first)
Yes, exactly. Here is how it works.
from flowy.
I am having issues getting the value out of the parent block. parent.querySelector(".blockelemtype").value returns Uncaught TypeError: parent.querySelector is not a function
from flowy.
These are the only properties I get from parent, I can't access the value property
{"parent":-1,"childwidth":318,"id":0,"x":1158,"y":327,"width":318,"height":120}
from flowy.
Oh oops, this is clearly an oversight from my part as the parent property of the on snap method should return a DOM element and not the array. I've just fixed it, so now you can access the div to get the value.
from flowy.
Thank you so much! Worked perfectly :)
from flowy.
One more question, to filter what block can be the root block, the first one in the canvas, I should filter in flowy.endDrag or in the snapping function? If I do it in snapping it seems to attach it anyway. Thank you!
from flowy.
Related Issues (20)
- More advanced demo? HOT 7
- Prevent junctions
- Is it possible to implement for nodes to have more than 1 parent? HOT 4
- How to use it in Vuejs ? HOT 3
- Output not getting imported HOT 2
- Can you give me a solution to use it in React js ? HOT 3
- Conditional Snapping Issue HOT 1
- Drag block item when scrolled
- Hey
- Unable to add text box in the flowchart
- Demo Site link working HOT 1
- Live demo link broken HOT 2
- [Feature request] Dark theme
- Create zoom canva preview
- Support? HOT 2
- How to split branches manually
- How to support cyclic relations between blocks in flowy
- Is this project abbandoned.?
- 【Feature】Support Add Node Programmatically Manually Automatically HOT 7
- Horizontal orientation
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 flowy.