Skip to content

Gracefully handle canvas resize #16

@jimbojw

Description

@jimbojw

Currently, if the canvas changes size, the visualization gets stretched out or squished. Instead, when the canvas is resized, the Scene offset and scale should be adjusted to preserve the aspect ratio of rendered Sprites.

This operation could be set to check for canvas size immediately before performing the draw call. If the canvas size has changed since the last call, then perform the offset/scale adjustment.

When performing the adjustment, there's a question as to which world coordinate to preserve. For example, it could be that the world origin maintains its position in pixel space relative to the top left of the canvas (or the center of the canvas). Consider what options might be appropriate and whether/how to expose them to the API user.

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