Incorrect mouse position due to `ctx.set_pixels_per_point`
Describe the bug
When setting a zoom factor with either ctx.set_pixels_per_point or ctx.set_zoom_factor the mouse position that is being "used in the GUI" doesn't match the mouse position that is shown on my monitor.
https://github.com/emilk/egui/assets/36443559/3d7ac0d6-5a3f-4199-8b8d-b63ca2ff1e57
To Reproduce
- Download the eframpe template (02ee968537e783e375a0e439426518bf91e762b6)
- add the following line:
impl TemplateApp {
/// Called once before the first frame.
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
// This is also where you can customize the look and feel of egui using
// `cc.egui_ctx.set_visuals` and `cc.egui_ctx.set_fonts`.
+ cc.egui_ctx.set_zoom_factor(1.5);
// Load previous app state (if any).
// Note that you must enable the `persistence` feature for this to work.
if let Some(storage) = cc.storage {
return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
}
Default::default()
}
}
Desktop (please complete the following information):
- OS: Windows 11
- Browser: Chrome v121, Firefox v123
Additional context This had been working as expected with egui/eframe 0.23
I can reproduce this, but only in the web assembly version
On web the browser should be in control of the zoom level, so that's probably why this is only a problem on web
I think #4260 fixes this. It's already released in 0.27.1