1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Add web support for zoom_factor (#4260)

Before, when setting the `zoom_factor`, the website was already
enlarged, but the zoom was ignored when calculating the logical window
size and mouse position, causing an offset between the actual cursor and
selected elements. That is addressed here

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
Justus Dieckmann
2024-03-29 11:55:49 +01:00
committed by GitHub
parent 60da4b4f65
commit 7cc98bd38e
5 changed files with 45 additions and 17 deletions

View File

@@ -185,6 +185,12 @@ pub struct Options {
/// presses Cmd+Plus, Cmd+Minus or Cmd+0, just like in a browser.
///
/// This is `true` by default.
///
/// On the web-backend of `eframe` this is set to false by default,
/// so that the zoom shortcuts are handled exclusively by the browser,
/// which will change the `native_pixels_per_point` (`devicePixelRatio`).
/// You can still zoom egui independently by calling [`crate::Context::set_zoom_factor`],
/// which will be applied on top of the browsers global zoom.
#[cfg_attr(feature = "serde", serde(skip))]
pub zoom_with_keyboard: bool,