Skip to content
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

Merged
merged 2 commits into from
Nov 13, 2020

Conversation

michaelkirk
Copy link
Collaborator

@michaelkirk michaelkirk commented Nov 13, 2020

resize mov

if err.to_string().contains("No such file") {
println!(
error!(
Copy link
Collaborator Author

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);
Copy link
Collaborator

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

@dabreegster
Copy link
Collaborator

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.

@dabreegster dabreegster merged commit 65897d8 into a-b-street:master Nov 13, 2020
@michaelkirk
Copy link
Collaborator Author

michaelkirk commented Nov 13, 2020

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 <canvas> element, whereas the <window> element is more akin to... I guess the "window manager" for a desktop program.

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).

@alvinhochun
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants