diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-08 14:14:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 14:14:10 +0100 |
commit | 3a5f45a6d14bfa35202d1611625eae23d052311b (patch) | |
tree | 6609369d9421b5f7cfdc81a72ec3de49a6f1e8e8 /core/math/rect2.h | |
parent | 343b29a651429eb57bf5acf95a14e2ff1773ab88 (diff) | |
parent | e5cb557b73d804b59a5eda30b4b09d3d18ea91ad (diff) |
Merge pull request #35682 from nathanwfranke/canvas-cull-control-fix
Fix bug where canvas culls things at origin with size 0
Diffstat (limited to 'core/math/rect2.h')
-rw-r--r-- | core/math/rect2.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h index 9017377770..0d2e7eb6e5 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -60,6 +60,19 @@ struct Rect2 { return true; } + inline bool intersects_touch(const Rect2 &p_rect) const { + if (position.x > (p_rect.position.x + p_rect.size.width)) + return false; + if ((position.x + size.width) < p_rect.position.x) + return false; + if (position.y > (p_rect.position.y + p_rect.size.height)) + return false; + if ((position.y + size.height) < p_rect.position.y) + return false; + + return true; + } + inline real_t distance_to(const Vector2 &p_point) const { real_t dist = 0.0; |