Skip to content

Commit

Permalink
Fix unable to ignore scale factor resize suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jun 7, 2023
1 parent e220a75 commit f215015
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ And please only add new entries to the top of this list, right below the `# Unre
instead of using the output bitmap size.
- On Web, scale factor and dark mode detection are now more robust.
- On Web, fix the bfcache by not using the `beforeunload` event.
- On Web, fix scale factor resize suggestion always overwriting the canvas size.

# 0.28.6

Expand Down
18 changes: 10 additions & 8 deletions src/platform_impl/web/event_loop/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,16 @@ impl<T: 'static> Shared<T> {
);

// Then we resize the canvas to the new size and send a `Resized` event:
backend::set_canvas_size(&canvas, crate::dpi::Size::Physical(new_size));
self.handle_single_event_sync(
Event::WindowEvent {
window_id: id,
event: crate::event::WindowEvent::Resized(new_size),
},
&mut control,
);
if current_size != new_size {
backend::set_canvas_size(&canvas, crate::dpi::Size::Physical(new_size));
self.handle_single_event_sync(
Event::WindowEvent {
window_id: id,
event: crate::event::WindowEvent::Resized(new_size),
},
&mut control,
);
}
}

// Process the destroy-pending windows again.
Expand Down

0 comments on commit f215015

Please sign in to comment.