Skip to content

Canvas WindowEvent::Resized feature in 0.29.0-beta.0 always reports size 0,0 before real size #2967

Description

@mcclure

Uncertain if this can be fixed or if it is inherent to how the web environment works:

I have a test web app using WebGPU. Source is here, a runnable web build (of commit bfdcc22 plus debug prints) is here (may require a current chrome, visuals may flicker a bit if run on a 1080p or smaller screen). I want this app to fill the window so I have a CSS rule for canvas: width:100%; height:100%; display:block;.

When I run my app, I find that at boot time, canvas size width and height is always 0,0. I then immediately receive a ResizedEvent with the "real" size. This forces me to take extra precautions so that my app doesn't crash in interesting ways when it gets a 0 (currently even the fixed way) and is generally annoying and potentially inefficient. It makes it less likely an app developed for desktop will work off the bat on web.

Can the initial, spurious(?) report of a 0,0 size be avoided?

I am running my tests in Chrome 114.0.5735.199 (only Chromium supports WebGPU so far)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions