Skip to content

Commit

Permalink
Revert "fix: Restore old canvas resize logic"
Browse files Browse the repository at this point in the history
This reverts commit f3100d9.
  • Loading branch information
nicksenger committed Feb 19, 2024
1 parent 7b0a6f1 commit 20c39e3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/platform_impl/web/web_sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ pub fn set_canvas_size(
style: &CssStyleDeclaration,
new_size: LogicalSize<f64>,
) {
let scale_factor = scale_factor(&web_sys::window().expect("Failed to obtain window"));
if !document.contains(Some(raw)) || style.get_property_value("display").unwrap() == "none" {
return;
}

let new_size = fix_canvas_size(style, new_size);
let physical_size = new_size.to_physical(scale_factor);

raw.set_width(physical_size.width);
raw.set_height(physical_size.height);

set_canvas_style_property(raw, "width", &format!("{}px", new_size.width));
set_canvas_style_property(raw, "height", &format!("{}px", new_size.height));
Expand Down

0 comments on commit 20c39e3

Please sign in to comment.