Skip to content

On Web, don't scale the canvas on scale factor changes #2864

@daxpedda

Description

@daxpedda

The documentation says about WindowEvent::ScaleFactorChanged::new_inner_size:

By default, this will contain the size suggested by the OS, but it can be changed to any value.

This isn't really possible on Web, because the Web doesn't suggest anything. After some IRC discussion we established that to be consistent with other backends, we should do whats usually "expected" here and scale the canvas with the scale factor, which is how it works currently anyway.

But this is often not desirable, because users usually want to control the size of the canvas through CSS and don't want Winit to overwrite it, which will be made possible by #2859. But changing the scale factor, will currently by default overwrite the any user defined CSS values, unless the user changes WindowEvent::ScaleFactorChanged::new_inner_size back to it's old value, which was taken into account by #2860.

I'm suggesting we should lean into the "suggested by the OS" argument, which in this case would be whatever CSS says is the new value, not overwriting any values set through CSS by default.

Metadata

Metadata

Assignees

Labels

C - needs discussionDirection must be ironed outDS - webAffects the Web backend (WebAssembly/WASM)S - enhancementWouldn't this be the coolest?

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions