Comments (24)
So grouped nodes are an interesting topic. I would like to implement something similar to: https://ni.i.lithium.com/t5/image/serverpage/image-id/68375i4C76101D2548C8AA?v=1.0 but I have not done it yet because its a little bit more involved:
-
firstly, I want group nodes to move their children. We can do this by having a new GroupNode which allows you to add child nodes, and when the translate method fires on the group, it can apply offsets to each descendant. The problem is that this logic is handled in the MoveEvent inside the DiagramWidget, so the logic would need to rather be implement there, as apposed to the model. Its actually not too difficult to do, but I have an idea in mind that relates to 'when any model is going to be moved, every model that is being moved, should be able to return an array of items including itself that need to be translated'. With this, implementing groups would be a relatively trivial task.
-
I want groups to be infinitely nest-able, but as mentioned in the previous point, this would be possible as a result.
-
I want groups to be collapsable, but that requires grouped elements which would hide, to have a visibility identifier. It would also require links that are connected to the elements which would hide, to rather connect to a temporary port that is at the center of the collapsed node. This however would need to NOT reflect in the model because it is purely a visual change, and not a change that should change which ports the link point to (even if it is temporary). So that particular feature would need to be implemented in the DiagramWidget code.
Groups are cool, but I've been thinking about the best, multi-functional way to do this that is more correct rather than just a hack. You are welcome to try implement it, but I at least am going to need some time to refine some of the concepts/finer implementation details before I could make this a reality.
from react-diagrams.
I don't really want to handle groups as top level because groups can be nested. Im going to introduce a new type of node that is a group with addNode and removeNode on it. The nodes will then be an array of id's on the group that gets serialized.
from react-diagrams.
I have sort of started working on this, you can read all about it here: http://dylanv.blog/2017/09/13/storm-react-diagrams-v3/
from react-diagrams.
from react-diagrams.
2019 and I finally got around to implementing the foundations for this feature in version 6 x_x.
from react-diagrams.
https://github.com/projectstorm/react-canvas Its finally happening :D
from react-diagrams.
Hey everyone, thought I would post an update here. Whats actually happening is probably the biggest and most important refactor of this library: storm-react-canvas. I am rewriting the entire library into two separate projects. storm-react-canvas which is closer to a graphics system such as in-design/quark-express and react-diagrams which will use this graphics system but reap the benefits of react-canvas. While developing group nodes, it became increasingly clear that we need a lot more capability that provides: resizing, grouping elements, multiple layers, better event handling and amongst other things, a better way to deterministically test the system if we want to support advanced features like this. I've been working on this solidly for the past week and I have a semi-working system up and running that can cater for all this but it is not quite ready for prime-time just yet. The second its ready, I will be creating a new project in the projectstorm organization and will open up a new branch in this library which will start making use of this base.
from react-diagrams.
This would be really awesome!
@dylanvorster : Any guides on how we can contribute to this?
Thanks!
from react-diagrams.
@dylanvorster hey, thanks you so much for the library, when do you plan to introduce this? We having quite complex application for react-diagrams and this feature is very important for us. Will it be soon or is it more reasonable to do it by our own?
From my vision it should also have a widget that will show inner graph on big zoom and on zoom out it could show some icon f.e.
Thanks.
from react-diagrams.
Great work! Can I suggest to include a playbook example whenever a feature like this is added? Also, can the playbook page contain some additional information or source code to describe what's going and how can I use it in my project without looking into the source code? Something like a "1.000ft" view documentation.
from react-diagrams.
Groups are cook and are essential )
I think groups should be like this:
{
"id": "f94a9a46-9ce3-49aa-8ecf-b4c74a86d283",
"offsetX": 0,
"offsetY": 0,
"zoom": 100,
"links": [{},{}],
"nodes": [{
id:'0',
type:'default',
ports:[{},{}]
},{
id:'1',
type:'group',
ports:[{},{}]
}],
"groups": [{
id:1,
"offsetX": 0,
"offsetY": 0,
"zoom": 100,
"links": [{},{}],
"nodes": [{
id:2,
type:'group',
ports:[{},{}]
},
id:2,
"offsetX": 0,
"offsetY": 0,
"zoom": 100,
"links": [{},{}],
"nodes": [{
id:3,
type:'default',
ports:[{},{}]
}]
}
the root level contains only nodes and group-nodes with only id and ports. All content of groups described in flat (not nested) array "groups".
But groups could be nested of corse (see example - group1 contains group2)
so root element and each group contains only elements to render and dont contains deeper elements
from react-diagrams.
@Timopheym Due to my own circumstances, I don't really have the need just yet for this feature, or the time to implement it properly. It would probably best if you could implement this yourself. It goes without saying though, that I'm fully open to pull requests :)
from react-diagrams.
Any examples on group nodes? Is it still WIP?
from react-diagrams.
Still need to get around to implementing a group widget, but would like to point out that using and overriding this method will allow moving a single node the ability to tell the system what other nodes should be moved:
react-diagrams/src/models/NodeModel.ts
Line 40 in 2c6d02f
from react-diagrams.
Thanks for your work! The use case for grouping for me is to show a link from the group itself to another group. So that it is possible to define a group based connection in addition to individual nodes inside the group.
So I guess, group is just another node with in/out ports that can have other nodes inside it.
from react-diagrams.
@cemremengu exactly right
from react-diagrams.
I have started work on this although its incredibly incomplete: #203
from react-diagrams.
from react-diagrams.
from react-diagrams.
Hi @dylanvorster react-canvas is looking great. Is there a way to use the work you've done on it so far with react-diagram?
from react-diagrams.
2019 and I finally got around to implementing the foundations for this feature in version 6 x_x.
We are still waiting! It would be great! How can we help you?
from react-diagrams.
@dylanvorster do you need help to release this?
from react-diagrams.
Great work! When can we see the release of group nodes feature , kindly help us here
from react-diagrams.
@dylanvorster awesome work! Any update on the group nodes? How can we help?
from react-diagrams.
Related Issues (20)
- custom code
- [Bug] Right angled links are diagonal if the points are added after the link is created
- 50 Errors in build HOT 2
- BezierCurve
- Tutorial not working HOT 1
- Deserialization not working HOT 2
- Demos should be refactored to be consistent with modern react standards and styles HOT 2
- I can't see the any nodes. HOT 1
- Is there a way with smart routing to ensure that the link line is never going through the node?
- Deregister Listener when links are created
- DragNewLinkState bug when pressing down with another mouse button while dragging.
- Does storm-react-diagrams support nonce attribute for CSP?
- Node EventListeners don't work when setting a state from component
- can't find createEngine export HOT 1
- Adding NodeModel to NodeLayer set itself as its parent, but NodeModel's parent must be a Diagram
- Module '"@projectstorm/react-diagrams"' has no exported member 'AbstractReactFactory'.
- Intermittent bug in dragNewLink with allowLooseLinks = false HOT 2
- Bug: running `diagrams-demo-project` error `TS2345: Argument of type 'Element' is not assignable to parameter of type 'ReactNode'. Property 'children' is missing in type 'Element' but required in type 'ReactPortal'.`
- Deserialization isn't working properly HOT 1
- got an error in gallary demo: diagrams-demo-gallery HOT 1
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 react-diagrams.