diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-01 00:05:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 00:05:02 +0100 |
commit | 8c7cd904f599b949972564ad13c3d4c1b016e977 (patch) | |
tree | a3836942ee699b90549240e5f9b3f6c0467e61cc /core | |
parent | ee6b4b5800686e86bdb522ffa5df74028bf49dca (diff) | |
parent | 23a4fe5b27c191eae1dde05aa522463e67b0766f (diff) |
Merge pull request #57469 from Sauermann/fix-rect2i-intersect
Diffstat (limited to 'core')
-rw-r--r-- | core/math/rect2.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h index 4ea24e8f88..b14c69302c 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -382,16 +382,16 @@ struct _NO_DISCARD_ Rect2i { ERR_PRINT("Rect2i size is negative, this is not supported. Use Rect2i.abs() to get a Rect2i with a positive size."); } #endif - if (position.x > (p_rect.position.x + p_rect.size.width)) { + if (position.x >= (p_rect.position.x + p_rect.size.width)) { return false; } - if ((position.x + size.width) < p_rect.position.x) { + if ((position.x + size.width) <= p_rect.position.x) { return false; } - if (position.y > (p_rect.position.y + p_rect.size.height)) { + if (position.y >= (p_rect.position.y + p_rect.size.height)) { return false; } - if ((position.y + size.height) < p_rect.position.y) { + if ((position.y + size.height) <= p_rect.position.y) { return false; } @@ -405,8 +405,8 @@ struct _NO_DISCARD_ Rect2i { } #endif return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) && - ((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) && - ((p_rect.position.y + p_rect.size.y) < (position.y + size.y)); + ((p_rect.position.x + p_rect.size.x) <= (position.x + size.x)) && + ((p_rect.position.y + p_rect.size.y) <= (position.y + size.y)); } _FORCE_INLINE_ bool has_no_area() const { |