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

Plot boxed zoom #1188

Merged
merged 8 commits into from
Feb 2, 2022
Merged

Plot boxed zoom #1188

merged 8 commits into from
Feb 2, 2022

Conversation

nongiach
Copy link
Contributor

Hello,

Very happy to make my first contribution here!

This adds boxed zooming feature on plots.
demo: https://www.youtube.com/watch?v=oUSWUgdFBCs

To allow the feature to work I added:

  • Plot::allow_boxed_zoom(bool). Default true
  • Plot::boxed_zoom_pointer(PointerButton). Default: Secondary
  • PlotMemory::last_click_pos_for_zoom: Option<Pos2>, Default None
  • ScreenTransform::bounds_mut(&mut self) -> &mut PlotBounds

Also changelog has been updated, check.sh is passing. And next time I will make sure to create an issue first.

I had a little non related issue in check.sh so double check for me please.

Regards,

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Please add instructions for this in the "Instructions" tab in the pot demo. It would also be good to document in the docstring for Plot.

CHANGELOG.md Outdated Show resolved Hide resolved
egui/src/widgets/plot/mod.rs Outdated Show resolved Hide resolved
egui/src/widgets/plot/mod.rs Outdated Show resolved Hide resolved
egui/src/widgets/plot/mod.rs Show resolved Hide resolved
nongiach and others added 5 commits January 31, 2022 21:09
add emlik update on changelog

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
add emlik update on comment in mod.rs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
@Bromeon
Copy link
Contributor

Bromeon commented Jan 31, 2022

This is a great feature! 👍

I wonder, if instead of a bool yes/no, it would make sense to have different modes?

enum RegionZoom {
   None,     // disallow
   Rect,     // rect/box, like current PR
   XRange,   // only horizontal, along X axis
   YRange,   // only vertical, along Y axis
}

The X/Y ones are for scaling only along one axis:

zoom

@nongiach
Copy link
Contributor Author

@emilk tests are passing my side, I updated with all your comments.
Let me know if we need additional update on this.

👍

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@emilk emilk merged commit 869d556 into emilk:master Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants