Closed lovesegfault closed 1 month ago
You could store the text size in the DepNodeShape
inside shapes
method. As it has &mut self
reference.
I will add an example with flex nodes to demonstrate it.
You could store the text size in the DepNodeShape inside shapes method. As it has &mut self reference.
But wouldn't that mean that if closest_boundary_point
or is_inside
are called before the first call to shapes
their results would be incorrect?
But wouldn't that mean that if closest_boundary_point or is_inside are called before the first call to shapes their results would be incorrect?
Yep, but only for 1 frame, which is negligible.
Please check the new example.
Closing this one. If you have any more questions, welcome in other tickets 😃
I was able to build on your example and get the result I wanted, thank you so much for taking the time!
This is a really cool lib :)
I wanted to try implementing a custom
NodeShape
to render the node labels inside a node rect. I came up with this as a starting point:Once I got to implement
is_inside
,closest_boundary_point
, andupdate
, I couldn't figure out how to continue.The issue is that the size of the surrounding Rect is dynamic on the length of the label, and I can only compute the
TextShape
whenctx: &DrawContext
is available, which isn't the case in those other methods.Is there a way to do this?