-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Introduce global zoom_factor
#3608
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emilk
force-pushed
the
emilk/zoom_factor
branch
from
November 22, 2023 16:16
3ce14e2
to
12da7c3
Compare
emilk
force-pushed
the
emilk/zoom_factor
branch
from
November 22, 2023 16:39
7fe5deb
to
a206f0b
Compare
I really feel that this should not be enabled by default. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
zoom_factor
#3602You can now zoom any egui app by pressing Cmd+Plus, Cmd+Minus or Cmd+0, just like in a browser. This will change the current
zoom_factor
(default 1.0) which is persisted in the egui memory, and is the same for all viewports.You can turn off the keyboard shortcuts with
ctx.options_mut(|o| o.zoom_with_keyboard = false);
zoom_factor
can also be explicitly read/written withctx.zoom_factor()
andctx.set_zoom_factor()
.This redefines
pixels_per_point
aszoom_factor * native_pixels_per_point
, wherenative_pixels_per_point
is whatever is the native scale factor for the monitor that the current viewport is in.This adds some complexity to the interaction with winit, since we need to know the current
zoom_factor
in a lot of places, because all egui IO is done in ui points. I'm pretty sure this PR fixes a bunch of subtle bugs though that used to be in this code.egui::gui_zoom::zoom_with_keyboard_shortcuts
is now gone, and is no longer needed, as this is now the default behavior.Context::set_pixels_per_point
is still there, but it is recommended you useContext::set_zoom_factor
instead.