Skip to content

OrthographicProjection's public fields are misleading #6190

@xgbwei

Description

@xgbwei

What problem does this solve or what need does it fill?

While working on #6177, I noticed some problems with OrthographicProjection's public fields:

  • left, right, bottom, and top, which are used to set the borders of the projection, are public, even though they'll be set automatically if scaling_mode is anything other than ScalingMode::None.

  • window_origin affects the origin of the scaling, which means it doesn't have any effect if scaling_mode is ScalingMode::None.

What solution would you like?

  • left, right, bottom, and top should be private with public getters. Maybe they can be set through ScalingMode::None's fields; this might make it a bit difficult to update though.

  • window_origin should be renamed to scaling_origin or something similar.

What alternative(s) have you considered?

Replace scale with separate width and height values, which will scale the entire projection whether scaling_mode is enabled or not. Then make window_origin (scaling_origin) more flexible with a fractional value of the width and height instead of just WindowOrigin::BottomLeft and WindowOrigin::Center. This will improve usability overall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorC-DocsAn addition or correction to our documentationC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions