-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX #379: web client resizes with window #388
Conversation
michaelkirk
commented
Nov 13, 2020
•
edited
Loading
edited
if err.to_string().contains("No such file") { | ||
println!( | ||
error!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had an unrelated issue were the scenarios were failing to load, but I couldn't read the println output in the browser.
@@ -39,6 +40,22 @@ pub fn setup(window_title: &str) -> (PrerenderInnards, winit::event_loop::EventL | |||
body.append_child(&canvas) | |||
.expect("Append canvas to HTML body"); | |||
|
|||
let winit_window = Rc::new(winit_window); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codebase's first Rc
! Now this counts as "advanced Rust", right? :D
Works great, thanks for the fix! Maybe in some ideal world, winit could do this, but it maybe doesn't belong at that layer anyway. |
Yeah, I was surprised at first too that we had to do something this manual. But after starting the work and thinking about it a bit, I came to the conclusion that it probably shouldn't live in winit. In the "wasm" world, a "winit::window" is a e.g. in the same way we could have multiple windows for a given desktop app, we could have multiple canvas elements in a single browser tab. Or maybe more common, some people might want the canvas element "winit::window" to be just one small part of a page. So the fact that our entire "web app" is a single full-size canvas element is not the only use case for winit (though I imagine it's a not uncommon one). |
rust-windowing/winit#1661 applies. It's hard to say exactly whether this should be a part of Winit or not, but nevertheless I believe we should figure out something so that users won't need to reimplement this exact function in every single project. |