diff --git a/crates/fj-viewer/src/gui.rs b/crates/fj-viewer/src/gui.rs index 549f897b1..a01fab7fd 100644 --- a/crates/fj-viewer/src/gui.rs +++ b/crates/fj-viewer/src/gui.rs @@ -79,12 +79,14 @@ impl Gui { pub(crate) fn update( &mut self, + pixels_per_point: f32, egui_input: egui::RawInput, config: &mut DrawConfig, aabb: &Aabb<3>, status: &StatusReport, line_drawing_available: bool, ) { + self.context.set_pixels_per_point(pixels_per_point); self.context.begin_frame(egui_input); let bounding_box_size = { diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index c2ec17af6..7f53e9d5c 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -119,7 +119,7 @@ impl Viewer { /// Draw the graphics pub fn draw( &mut self, - scale_factor: f32, + pixels_per_point: f32, status: &mut StatusReport, egui_input: egui::RawInput, ) { @@ -132,6 +132,7 @@ impl Viewer { self.camera.update_planes(&aabb); self.gui.update( + pixels_per_point, egui_input, &mut self.draw_config, &aabb, @@ -142,7 +143,7 @@ impl Viewer { if let Err(err) = self.renderer.draw( &self.camera, &self.draw_config, - scale_factor, + pixels_per_point, &mut self.gui, ) { warn!("Draw error: {}", err); diff --git a/crates/fj-window/src/run.rs b/crates/fj-window/src/run.rs index 37ef1fc4d..08a432763 100644 --- a/crates/fj-window/src/run.rs +++ b/crates/fj-window/src/run.rs @@ -201,14 +201,13 @@ pub fn run( viewer.handle_screen_resize(size); } + let pixels_per_point = window.window().scale_factor() as f32; + + egui_winit_state.set_pixels_per_point(pixels_per_point); let egui_input = egui_winit_state.take_egui_input(window.window()); - viewer.draw( - window.window().scale_factor() as f32, - &mut status, - egui_input, - ); + viewer.draw(pixels_per_point, &mut status, egui_input); } _ => {} }