-
Notifications
You must be signed in to change notification settings - Fork 943
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
Allow canvas size to be controlled by page layout on web target #1661
Comments
I think that's a great idea. I don't have time to implement it myself for now, but I would be happy to review a PR. |
I would like to give this a go, but |
A bit of reflection from my POC experiment:
|
@alvinhochun for the second point in the list about the fallback path, does winit already add event listeners to window resize events for window resizing (i.e. not only switching between full-screen mode)? |
Without checking the source code, I don't recall Winit currently utilizing the window |
What's the status on this? I'm blocked from creating a fullscreen experience without this. |
AFAIK nobody is working on it. I have the rough idea on how it can be done in practice and there is the proof-of-concept. I had wanted to write the final implementation, but I got caught by other personal matters so I don't have an estimate when I would be available to do it. Another note is that my idea is pretty generic, as it aims to support any CSS page layout positioning, which makes the implementation quite complicated. If your aim is only to have the canvas to fill the page viewport, it is actually much easier to do as you just need to rely on the window resize event without the complexity of ResizeObserver. You can implement it yourself using something like a-b-street/abstreet#388. |
There is an open pull request for this: #2074 |
Pog |
Currently, the web target uses a fixed window size and it sizes the canvas based on it. It would be nice to instead have a mode that allows the canvas to be laid out on the page with CSS layout like flexbox or CSS grid. The resizing of the element can be detected using
ResizeObsever
, which can also handle pixel-perfect canvas sizing (#1659 (comment)). In this mode, thewinit
window should not be resizable by user code.The text was updated successfully, but these errors were encountered: