Skip to content

Emscripten: device rotation doesn't emit resize events  #7359

Open
@ericoporto

Description

@ericoporto

I think emscripten_set_orientationchange_callback should be included in src/video/emscripten/SDL_emscriptenevents.c, so it can generate a resize event.

See Device Orientation in Emscripten API documentation.

As is now, rotating the device doesn't produce any event, so even though the canvas css size changes, this isn't update inside SDL, and the application can't get a window resize event.

I tried this workaround below, but it didn't work, no SDL resize event is generated on orientation changed - but listening to the resize event in JS I can see it indeed happens.

window.addEventListener("orientationchange", function() {
    window.dispatchEvent(new Event("resize"));
  }, false);

You can use chrome://inspect#devices for remote debugging from chrome, if using an Android device.

To be honest, rotation and resizing for me are different things, but from the comment here, it seems it's settled they should be the same, so at least the events should be produced here - or alternatively some rotation event.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions