Fix buggy interaction with widgets outside of clip rect #4675
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.
This fixes a bug which sometimes would make it possible to interact with widgets that were outside the parent clip_rect.
Interaction with a widget is done with the
interact_rect
, which is the intersection of the widget rect and the parent clip rect. If these rectangles are disjoint (the widget is outside the parent clip rect), this results in a negative rectangle (a rectangle with a negative width and/or height). The distance tests for negative rectangles were broken, causing the bug.SidePanel
frame leaks intoBottomPanel
#4475Breaking changes
Rect::distance_to_pos
,distance_sq_to_pos
,signed_distance_to_pos
now all returnf32::INFINITY
if the rectangle is negative.