setzer22 / egui_node_graph

Build your node graph applications in Rust, using egui
MIT License
718 stars 134 forks source link

Node zoom #101

Open hakolao opened 1 year ago

hakolao commented 1 year ago

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).

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...

ttddee commented 9 months ago

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.

Peek 2024-01-04 11-08

Not sure if I am doing something wrong or if the clip rect needs to be adjusted?

hakolao commented 8 months ago

Might be that the clip rect should be adjusted. Don't mind a fix!

ttddee commented 8 months ago

This fixes the problem for me but I am still wondering why the clip_rect is wrong in the first place.

Still learning egui...

plfort commented 8 months ago

Hello @setzer22 , is there a chance this PR will be accepted?

hakolao commented 8 months ago

Because I use this in my project, I've kept the fork up to date. Still find it very usable :)