Skip to content

Commit

Permalink
Fixed TouchScreenButton::shape_centered having no effect
Browse files Browse the repository at this point in the history
The problem was that the shape_centered depended on TouchScreenButton::texture having a Texture
  • Loading branch information
Muller-Castro committed Oct 19, 2019
1 parent 119bf23 commit 127c2d7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scene/2d/touch_screen_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,12 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
}

Rect2 TouchScreenButton::_edit_get_rect() const {
if (texture.is_null())
return CanvasItem::_edit_get_rect();
if (texture.is_null()) {
if (shape.is_valid())
return shape->get_rect();
else
return CanvasItem::_edit_get_rect();
}

return Rect2(Size2(), texture->get_size());
}
Expand Down

0 comments on commit 127c2d7

Please sign in to comment.