Node zoom
The node graph needs zoom badly.
So here is an implementation inspired by https://github.com/gzp-crey/shine, and the style scaling was copied from there as well.
Because this is just me updating stuff from a fork, this also contains egui 0.22, and placement of node rather to finder window pos than mouse pos (mouse can be outside graph area when finder window is large).
- The zoomed style during runtime is retained in
PanZoom, it uses parent ui's style by default, but when in a zoomed state, a scaled style is used - And the zoom is towards center of the ui area. I find towards mouse zoom unintutive, but feel free to change that.
- Node positions are updated by the delta when zoomed
- I like this, because the we can keep the pan untouched.
All in all, this seems to work pretty well... though not optimal, pan_zoom's scale needs to be used in a couple of places... But better than having double egui context in my opinion.
What it looks like:
https://github.com/setzer22/egui_node_graph/assets/12234005/5cb8c57a-8864-4aca-94de-57589f20dd98
Feel free to edit MAX, MIN zooms and anything that should be changed...
I have merged this into my own fork and it works great.
One problem I encountered though is that the node graph flows out the top of the TopBottomPanel I have put it into here.
Not sure if I am doing something wrong or if the clip rect needs to be adjusted?
Might be that the clip rect should be adjusted. Don't mind a fix!
This fixes the problem for me but I am still wondering why the clip_rect is wrong in the first place.
Still learning egui...
Hello @setzer22 , is there a chance this PR will be accepted?
Because I use this in my project, I've kept the fork up to date. Still find it very usable :)