diff options
author | Mateo Kuruk Miccino <mateomiccino@gmail.com> | 2020-05-07 11:04:59 -0300 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-05-07 21:21:13 +0200 |
commit | e253451a5b01926a32aa52bf2e78150f0f9f4bd5 (patch) | |
tree | 8a0724aa396ac5a7785515846932a9602a9245e3 /scene | |
parent | d7b85fbaa1fc438effe406c9d7f973749eb4e527 (diff) |
GUI: Touch screen button click area now is synced with its draw
(cherry picked from commit 1cba7fb1804c35917c075e323b6d303f5a900df6)
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/touch_screen_button.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 85fd05ac15..590cc1e6c4 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -260,9 +260,10 @@ bool TouchScreenButton::_is_point_inside(const Point2 &p_point) { bool check_rect = true; if (shape.is_valid()) { - check_rect = false; - Transform2D xform = shape_centered ? Transform2D().translated(shape->get_rect().size * 0.5f) : Transform2D(); + + Vector2 size = texture.is_null() ? shape->get_rect().size : texture->get_size(); + Transform2D xform = shape_centered ? Transform2D().translated(size * 0.5f) : Transform2D(); touched = shape->collide(xform, unit_rect, Transform2D(0, coord + Vector2(0.5, 0.5))); } |