Skip to content

CGRect::standardize and CGRect::is_empty behavior for negative sizes #806

@andyleiserson

Description

@andyleiserson

The Apple documentation is somewhat ambiguous about how these should behave. https://stackoverflow.com/questions/35608638/accessing-cgrect-values-directly-vs-normalizing-them-in-swift-objective-c-rule and at least one GitHub code result suggest that standardizing a rectangle should move the origin if the size is negated (i.e. the rectangle should remain the same, vs. flip over the origin).

The current Rust implementation of CGRect::standardize only normalizes the size, leaving the origin unchanged.

Also, CGRect::is_empty returns !(self.size.width > 0.0 && self.size.height > 0.0), so will treat a negative-sized rectangle as empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frameworkAffects the framework crates and the translator for thembugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions