mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 07:03:14 -04:00
* Closes https://github.com/emilk/egui/issues/3602 You 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 with `ctx.zoom_factor()` and `ctx.set_zoom_factor()`. This redefines `pixels_per_point` as `zoom_factor * native_pixels_per_point`, where `native_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 use `Context::set_zoom_factor` instead.
76 lines
2.9 KiB
TOML
76 lines
2.9 KiB
TOML
# There is also a scripts/clippy_wasm/clippy.toml which forbids some mthods that are not available in wasm.
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Section identical to scripts/clippy_wasm/clippy.toml:
|
|
|
|
msrv = "1.72"
|
|
|
|
allow-unwrap-in-tests = true
|
|
|
|
# https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api
|
|
# We want suggestions, even if it changes public API.
|
|
avoid-breaking-exported-api = false
|
|
|
|
max-fn-params-bools = 2 # TODO(emilk): decrease this to 1
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file
|
|
max-include-file-size = 1000000
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#/type_complexity
|
|
type-complexity-threshold = 350
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_macros
|
|
disallowed-macros = [
|
|
'dbg',
|
|
'std::unimplemented',
|
|
|
|
# TODO(emilk): consider forbidding these to encourage the use of proper log stream, and then explicitly allow legitimate uses
|
|
# 'std::eprint',
|
|
# 'std::eprintln',
|
|
# 'std::print',
|
|
# 'std::println',
|
|
]
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
|
|
disallowed-methods = [
|
|
"std::env::temp_dir", # Use the tempdir crate instead
|
|
|
|
# There are many things that aren't allowed on wasm,
|
|
# but we cannot disable them all here (because of e.g. https://github.com/rust-lang/rust-clippy/issues/10406)
|
|
# so we do that in `clipppy_wasm.toml` instead.
|
|
|
|
"std::thread::spawn", # Use `std::thread::Builder` and name the thread
|
|
|
|
"sha1::Digest::new", # SHA1 is cryptographically broken
|
|
|
|
"std::panic::catch_unwind", # We compile with `panic = "abort"`
|
|
]
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names
|
|
disallowed-names = []
|
|
|
|
# https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
|
|
disallowed-types = [
|
|
# Use the faster & simpler non-poisonable primitives in `parking_lot` instead
|
|
"std::sync::Mutex",
|
|
"std::sync::RwLock",
|
|
"std::sync::Condvar",
|
|
# "std::sync::Once", # enabled for now as the `log_once` macro uses it internally
|
|
|
|
"ring::digest::SHA1_FOR_LEGACY_USE_ONLY", # SHA1 is cryptographically broken
|
|
|
|
"winit::dpi::LogicalSize", # We do our own pixels<->point conversion, taking `egui_ctx.zoom_factor` into account
|
|
"winit::dpi::LogicalPosition", # We do our own pixels<->point conversion, taking `egui_ctx.zoom_factor` into account
|
|
]
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Allow-list of words for markdown in dosctrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
|
|
doc-valid-idents = [
|
|
# You must also update the same list in the root `clippy.toml`!
|
|
"AccessKit",
|
|
"..",
|
|
]
|