Skip to content

Plot boxed zoom - #1188

Merged
emilk merged 8 commits into
emilk:masterfrom
nongiach:plot_boxed_zoom
Feb 2, 2022
Merged

emilk merged 8 commits into
emilk:masterfrom
nongiach:plot_boxed_zoom

Conversation

@nongiach

Copy link
Copy Markdown

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,

@emilk emilk left a comment

Copy link
Copy Markdown
Owner

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.

Comment thread CHANGELOG.md Outdated
Comment thread egui/src/widgets/plot/mod.rs Outdated
Comment thread egui/src/widgets/plot/mod.rs Outdated
Comment thread egui/src/widgets/plot/mod.rs
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

Bromeon commented Jan 31, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Author

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

👍

@emilk emilk left a comment

Copy link
Copy Markdown
Owner

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