Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Node zoom #101

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Node zoom #101

wants to merge 23 commits into from

Conversation

hakolao
Copy link
Contributor

@hakolao hakolao commented Jun 13, 2023

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:

Recording.2023-06-13.233343.mp4

Feel free to edit MAX, MIN zooms and anything that should be changed...

@ttddee
Copy link

ttddee commented Jan 4, 2024

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
Copy link
Contributor Author

hakolao commented Jan 11, 2024

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

@ttddee
Copy link

ttddee commented Jan 11, 2024

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
Copy link

plfort commented Feb 2, 2024

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

@hakolao
Copy link
Contributor Author

hakolao commented Feb 2, 2024

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants