Skip to content

Commit

Permalink
check fullscreen using window.screen.height
Browse files Browse the repository at this point in the history
  • Loading branch information
OmmyZhang committed Feb 4, 2024
1 parent ed35660 commit abad75f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
yew = { version="0.21", features = ["csr"] }
rand = "0.8.5"
web-sys = { version="0.3.66", features = ["DomRect", "HtmlCanvasElement", "CanvasRenderingContext2d", "HtmlImageElement", "Window", "TextMetrics"] }
web-sys = { version="0.3.67", features = ["DomRect", "HtmlCanvasElement", "CanvasRenderingContext2d", "HtmlImageElement", "Window", "TextMetrics", "Screen"] }
gloo-timers = "0.3.0"
gloo-console = "0.3.0"
trunk = "0.18.6"
11 changes: 2 additions & 9 deletions src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,8 @@ pub fn game(props: &Props) -> Html {
let mh = use_state(|| props.mh);

let is_full = use_memo(*is_moving, |_| {
window()
.unwrap()
.top()
.unwrap()
.unwrap()
.document()
.unwrap()
.fullscreen_element()
.is_some()
window().unwrap().inner_height().unwrap().as_f64().unwrap() as i32
== window().unwrap().screen().unwrap().height().unwrap()
});

let v_onchange = {
Expand Down

0 comments on commit abad75f

Please sign in to comment.