lapce / floem

A native Rust UI library with fine-grained reactivity
https://lap.dev/floem/
MIT License
2.98k stars 131 forks source link

Absolute positioning layout widget for node graphs #506

Open giannissc opened 4 months ago

giannissc commented 4 months ago

Hi there! I was wondering if someone can give me some pointers on how to implement a absolute layout widget to be used with something like a node graph? I have used the PanZoom widget that was posted on discord and modified it to implement snapping and show a grid, but it currently doesn't support adding other widgets to it. Following the virtualList and VirtualStack it is unclear to me what exactly is needed.

https://github.com/lapce/floem/assets/20277283/0ae09b68-fe18-4919-ba72-61674b3e9c72

dzhou121 commented 4 months ago

It feels like the best approach would probably be a custom widget, e.g., you'd paint the grid yourself.

giannissc commented 4 months ago

That's what I am trying to do but I am not sure which aspects of the other layout widgets to copy? The two virtual widget currently in floem have some differences. For example the stack uses a diff and stores the children in it's strict definition as well as in the ECS so I am not sure which of the two more closely follows the way thing should be done in floem

dzhou121 commented 4 months ago

Does this need to contain other widgets? If so, the logic would be similar to the virtual list.

giannissc commented 3 months ago

Are there any plans to add a virtual_canvas widget to floem at some point?