Blazor.Diagrams icon indicating copy to clipboard operation
Blazor.Diagrams copied to clipboard

How to zoom to fit automatically

Open jonhilt opened this issue 2 years ago • 5 comments

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!

jonhilt avatar Mar 30 '23 15:03 jonhilt

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?

zHaytam avatar Mar 31 '23 20:03 zHaytam

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

jonhilt avatar Apr 01 '23 18:04 jonhilt

Hi, I have the same question, did you find a solution?

Thanks, Dilan

PDilan321 avatar Aug 16 '23 09:08 PDilan321

Still having issues with this when trying to ZoomToFit with SVG nodes.

PDilan321 avatar Sep 11 '23 13:09 PDilan321

Hi, I have the same question. Any update on that issue?

Thanks Marcel

mueller-marcel avatar Jul 11 '24 08:07 mueller-marcel