Skip to content

Commit 9b8d36b

Browse files
adjust ui scale on resize
1 parent fc1993a commit 9b8d36b

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,3 @@ trunk serve --features webgl --open
2828

2929
![Screenshot 2024-08-20 at 8 17 14 AM](https://github.com/user-attachments/assets/fd841943-a80b-4f27-9d9e-f85bb03d8add)
3030
![Screenshot 2024-08-20 at 8 17 51 AM](https://github.com/user-attachments/assets/383d0122-f26d-41db-b1de-35512d697830)
31-
32-
## Note for Mac Users
33-
34-
On Macbooks, the web application's UI scaling will be incorrect
35-
if not running at the laptop screen's native resolution.
36-
37-
To run the app in the web browser properly,
38-
set your laptop's resolution to it's highest possible option.
39-
40-
On a `Macbook M2 Air`:
41-
42-
`Option + F2` -> `Show All Resolutions` -> `2880 x 1864` (highest resolution)

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ impl ApplicationHandler for App {
171171
log::info!("Resizing renderer surface to: ({width}, {height})");
172172
renderer.resize(width, height);
173173
self.last_size = (width, height);
174+
175+
let scale_factor = window.scale_factor() as f32;
176+
gui_state.egui_ctx().set_pixels_per_point(scale_factor);
174177
}
175178
WindowEvent::CloseRequested => {
176179
log::info!("Close requested. Exiting...");

0 commit comments

Comments
 (0)