Open markusmoenig opened 1 year ago
The web example does cover all available space in the Browser window, with the same image scaling rules as with native windows. E.g. it will only scale to even integer ratios, leaving a black border as in the screenshot:
Resize is already handled: https://github.com/parasyte/pixels/blob/cbda7df53b54be03b9b40bacbf46bc6b2dbaa13a/examples/minimal-web/src/main.rs#L88-L97 and https://github.com/parasyte/pixels/blob/cbda7df53b54be03b9b40bacbf46bc6b2dbaa13a/examples/minimal-web/src/main.rs#L130-L137
For keyboard focus, I think it can be done with some extra web-sys
stuff. With access to the canvas
element that winit
manages, you would call the focus()
method on it. Probably need to verify that winit
adds an event listener to the canvas (I'm not really sure if it does, maybe it adds a global event listener to the window). If it's a global event listener, then calling focus()
on the window should be enough.
Ah, you are right, I forgot that you scale up to even aspect ratios and mistook the black border for unused space. Perfect!
Thanks for the info re web-sys
, will look into it.
Hi,
not a web expert here..., two questions on the web example:
Thanks as always!