Closed ChuckBerg closed 2 years ago
Hello,
I think the reason boundingBox
is null
is because the bounds of a node are calculated asynchronously via JavaScript, so when you call GetBounds()
directly in OnAfterRender
these values haven't been calculated yet.
You can test this if you add a button to your page and try to read the bounding box in the button event handler, there you will get the correct values.
Another way to get the bounds is to listen to the OnChanged
or OnSizeChanged
events of a node. These are called after the node was rendered and the size calculations are finished.
Hello,
Indeed, @314159265meow is right. Since dimensions and positions are calculated after the elements are rendered, they won't be available to you right away.
Thanks for the feedback, guys. Unfortunately, I had to get something working so I've taken a different approach and am not using Blazor.Diagrams anymore. I may switch back sometime later in the project.
Chuck
If it's possible, may I know what you used as the alternative? Thank you and good luck in your project!
I only need the ability to create static flowcharts, so CSS for placement of nodes, and LeaderLine for the connecting lines and arrows.
Okay! Good luck with your project.
I'm trying to get the bounding box for each of my custom components so that I can dynamically adjust their positions at runtime. Here's my latest attempt.
Everything renders as I expect, but it's not laid out properly. Unfortunately, boundingBox is always null so I can't adjust positions the way I'd like. Any thoughts?