Skip to content

Use object bounds to filter mouse interactions. #496

Open
@gskinner

Description

@gskinner

There have been a number of questions and Pull Requests regarding using object bounds to reduce draws when calculating mouse targets.

This is possible for Bitmap and Sprite, as they have accurate bounds. However, Text, Shape, and Container do not. The first step here should be benchmarking a rough implementation for Bitmap to see how much of a cost savings it offers in that scenario.

Implementation ideas:
We could add DisplayObject.accurateBounds or similar. This would be false by default, and overwritten to true for Bitmap and Sprite. Likewise, it could be set to true when setBounds() is used. We could then do bounds checks for any object that has it set to true.

Container would be fine set to false by default, I don't think there's any performance benefit to calculating the aggregate bounds if we're going to be checking the bounds of the children anyway.

Feedback on this proposal is welcome.

There are others, but here's a couple of examples: #401, #420

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions