Skip to content

Commit

Permalink
GUI: Touch screen button click area now is synced with its draw
Browse files Browse the repository at this point in the history
(cherry picked from commit 1cba7fb)
  • Loading branch information
kuruk-mm authored and akien-mga committed May 7, 2020
1 parent d7b85fb commit e253451
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scene/2d/touch_screen_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down

0 comments on commit e253451

Please sign in to comment.