Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to zoom a Plot programmatically #2714

Merged
merged 3 commits into from
Jan 6, 2024

Conversation

YgorSouza
Copy link
Contributor

  • Added methods to zoom the plot programmatically, to match the previously added translate_bounds().
  • Added an example of how this method can be used to customize the plot navigation.

Closes #1164.

@YgorSouza
Copy link
Contributor Author

YgorSouza commented Apr 18, 2023

Just need to figure out why the zoom doesn't work until you have scrolled at least once (trying to understand the new plot logic, as it changed a lot from when this PR was opened) (fixed). And then see if it would be better to move the example to the demo app instead, so it's easier to test for web as well.

crates/egui/src/widgets/plot/mod.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/plot/mod.rs Outdated Show resolved Hide resolved
examples/custom_plot_manipulation/src/main.rs Show resolved Hide resolved
examples/custom_plot_manipulation/Cargo.toml Outdated Show resolved Hide resolved
examples/custom_plot_manipulation/Cargo.toml Show resolved Hide resolved
examples/custom_plot_manipulation/Cargo.toml Outdated Show resolved Hide resolved
examples/custom_plot_manipulation/src/main.rs Show resolved Hide resolved
@YgorSouza YgorSouza marked this pull request as ready for review September 16, 2023 13:33
@YgorSouza YgorSouza changed the title Draft: Plot custom zoom Plot custom zoom Sep 16, 2023
@knoellle
Copy link

knoellle commented Dec 9, 2023

I am also interested in this feature.
Is there anything blocking this apart from missing labels?

So you can bind different keyboard/mouse gestures to it, lock the X or Y
axis, customize the zoom speed etc.
@alufers
Copy link

alufers commented Jan 5, 2024

Also interested in this!

My usecase is manipulating a video preview:

thermal_zoom.mp4

I'd like to zoom in-out without using ctrl, because scrolling the preview up and down makes little sense.

@emilk emilk added the egui_plot Related to egui_plot label Jan 6, 2024
crates/egui_plot/src/lib.rs Outdated Show resolved Hide resolved
@emilk emilk merged commit 5ed2c0a into emilk:master Jan 6, 2024
19 checks passed
@emilk emilk changed the title Plot custom zoom Custom Plot zoom Jan 6, 2024
@emilk emilk changed the title Custom Plot zoom Add methods to zoom a Plot programmatically Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_plot Related to egui_plot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom zoom configuration
4 participants