retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
10k stars 651 forks source link

rete-auto-arrange-plugin needs height property defined #712

Open Krong opened 1 month ago

Krong commented 1 month ago

Describe the bug

If node has property height defined, then auto-arrange working fine, but node does not rendered properly - conrols can go outside of node. If node has property height undefined, then node autosizes height as needed, but auto-arrange is not working.

Guess that auto-arrange-plugin should autocalc node height like document.getElementById("div1").clientHeight or similar.

Example to reproduce

No response

How to reproduce

create a several nodes without height defined call auto-arrange

Expected behavior

auto-arrange nodes

Dependencies

"rete": "^2.0.3",
"rete-auto-arrange-plugin": "^2.0.1",

Platform

Chrome 121.0.6167.139

Relevant log output

No response

Code of Conduct

Ni55aN commented 1 month ago

auto-arrange-plugin should autocalc node height like document.getElementById("div1").clientHeight

This won't work because the first arrangment may be performed before the nodes are rendered. For instance, LOD example doesn't render complete HTML node elements at all, but this is not a blocker for using the arrange plugin (although it is not actually used in this example)

Therefore, despite this solution is not built in, you can implement it: wait until nodes are rendered (this is not controlled by the framework itself, e.g. using animated nodes), and sync Node's height with htmlElement.clientHeight