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 buttons and shortcuts for zooming the whole GUI #265

Merged
merged 13 commits into from
Nov 7, 2022
Merged

Conversation

emilk
Copy link
Member

@emilk emilk commented Nov 5, 2022

You can now zoom the whole GUI with ⌘+ and ⌘- (or Ctrl+Plus/Ctrl+Minus), just like on the web, or an electron app.

Based on emilk/egui#2239

zoom-gui

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I've added a line to CHANGELOG.md (if this is a big enough change to warrant it)

@Wumpf
Copy link
Member

Wumpf commented Nov 6, 2022

getting thread 'main' panicked at 'Bad size: inf', crates/re_viewer/src/ui/view3d/scene.rs:36:9 when zooming in too far

@Wumpf
Copy link
Member

Wumpf commented Nov 6, 2022

also introduces a curious bug (doubled checked it really happens only on this branch and it does): When the window starts its life on a high dpi screen and goes to a lower dpi screen, the title bar now doubles in size:

image

@emilk
Copy link
Member Author

emilk commented Nov 6, 2022

Ooh, thanks for finding those problems! I'll get right on it

@emilk emilk requested a review from Wumpf November 6, 2022 19:21
@emilk
Copy link
Member Author

emilk commented Nov 7, 2022

Screen Shot 2022-11-07 at 11 18 41

There may still be some work to do…

Seems like eframe doesn't update native_pixels_per_point when DPI changes.

EDIT: will be fixed by emilk/egui#2256

crates/re_viewer/src/app.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/app.rs Outdated Show resolved Hide resolved

// On Mac, we share the same space as the native red/yellow/green close/minimize/maximize buttons.
// This means we need to make room for them.
let native_buttons_size_in_native_scale = egui::vec2(64.0, 24.0); // source: I measured /emilk
Copy link
Member

Choose a reason for hiding this comment

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

did you try this on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a Mac-only setting.

Comment on lines +776 to +780
// On the web the browser controls the zoom
if !frame.is_web() {
egui::gui_zoom::zoom_menu_buttons(ui, frame.info().native_pixels_per_point);
ui.separator();
}
Copy link
Member

Choose a reason for hiding this comment

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

actually I can't zoom at all on the web since we grab cmd +

Copy link
Member Author

Choose a reason for hiding this comment

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

Where do we grab cmd +?

I can zoom with cmd+/- on Mac Firefox on https://www.egui.rs/ - can you?

Copy link
Member

Choose a reason for hiding this comment

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

ah apologies, I meant cmd + scrollwheel. Cmd + works

@emilk emilk merged commit 029505e into main Nov 7, 2022
@emilk emilk deleted the emilk/zoom-ui branch November 7, 2022 11:36
@martinkeefe
Copy link

Nice! A little bit disappointing that it doesn't seem to respond to ctrl+ or ctrl- when using the keys on the num pad on Windows by default.

@Wumpf
Copy link
Member

Wumpf commented Apr 16, 2023

Filed a bug for that now! ⬆️

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