diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-02-21 14:48:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 14:48:43 +0100 |
commit | 47c4ec7f1d70fa06099e1ab3888f9d2595a08fa7 (patch) | |
tree | acf1dd8d02033e54c5a2c95c476a8e73e8e89cb7 /scene | |
parent | cac1a93d1b033c2afb06b831a297523252cc49b3 (diff) | |
parent | f07dfe8a3fd8f70523bdd1406e2b5d3baa02d828 (diff) |
Merge pull request #26105 from nekomatata/texture-button-mask-fix
TextureButton with click mask only can be clicked
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/texture_button.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index c165c5a545..19bef9fdf5 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -64,7 +64,9 @@ bool TextureButton::has_point(const Point2 &p_point) const { Rect2 rect = Rect2(); Size2 mask_size = click_mask->get_size(); - if (_tile) { + if (_position_rect.no_area()) { + rect.size = mask_size; + } else if (_tile) { // if the stretch mode is tile we offset the point to keep it inside the mask size rect.size = mask_size; if (_position_rect.has_point(point)) { @@ -216,6 +218,8 @@ void TextureButton::_notification(int p_what) { draw_texture_rect(texdraw, _position_rect, _tile); else draw_texture_rect_region(texdraw, _position_rect, _texture_region); + } else { + _position_rect = Rect2(); } if (has_focus() && focused.is_valid()) { |