Skip to content

It's not easy to validate clientSpaceToScratchBounds results #353

Open
@cwillisf

Description

@cwillisf

Expected Behavior

It should be easy to check if clientSpaceToScratchBounds has returned valid bounds.

Actual Behavior

Sometimes clientSpaceToScratchBounds returns invalid bounds and the only way to check is by inspecting each property of the Rectangle it returns. See also #349

Suggested fix

Add an isValid check on Rectangle which returns true if all of these are true:

  • All properties are finite (probably using Math.isFinite)
  • left <= right
  • bottom <= top

Then, call the new isValid check from pick (as in #349) and anywhere else that might need to check the validity of a Rectangle.

This isn't the only valid approach to fixing this; if you think you have a better solution feel free to submit a pull request!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions