The stage click handler does not properly ignore events outside it's bounds when x,y transforms are applied #286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consider this scenario. You have stage 1 and stage 2 side by side. Both have DisplayObjects which register for DblClick. In stage 2, you've set stage.x and stage.y so the coordinate space of the stage is shifted on top of stage 1's physical space. (I have a game where the two stages are showing different parts of the game world, side by side.) When you click on Stage 1, both stage 1 and stage 2 receive a double click event. When testing for a hit, the Stage class uses the event's X and Y, which have already had the transform applied. This causes the Stage 2 to think the hit occurred within it's bounds, even though the event's inBounds property is false, this value is never checked.
End result: The click event fires for both Stage 1 and Stage 2, even though the click was outside Stage 2.
Adding a simple check for inBounds in the hit testing functions fixed the issue. Tiny commit!