Blazor.Diagrams
Blazor.Diagrams copied to clipboard
How to zoom to fit automatically
Hey,
I'm exploring using Blazor.Diagrams for rendering a read-only tree view in my app.
I've seen the code (and demos) for using GraphShape to automatically arrange nodes, plus the ZoomToFit method, to get everything lined up and visible.
My question is, is there a way to do this without any user interaction.
Rather than have a user click a button to arrange and zoom the diagram, ideally I'd want that to happen automatically.
So my code would:
- Create the diagram
- Add nodes, ports, links
- Auto-layout and zoom to fit
All without any user interaction.
Is that possible?
Thanks!
Hello,
- Do you know the size of your nodes beforehand?
- Are you going to be using ports or direct links between nodes?
- If you're using ports, do you know their size and positions beforehand and without CSS?
Hey, thanks for the reply :)
So every node will be the same, fixed size (using a custom node type) and yep I'll know the size beforehand.
I was planning on using ports (as I prefer it aesthetically) and yes I would know their size and position ahead of time.
Thanks, Jon
Hi, I have the same question, did you find a solution?
Thanks, Dilan
Still having issues with this when trying to ZoomToFit with SVG nodes.
Hi, I have the same question. Any update on that issue?
Thanks Marcel