diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-31 18:22:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-31 18:22:58 +0100 |
commit | 7da9e31f66c49e8b705b8a1713a2cf3526ed48c6 (patch) | |
tree | 7847e8e4d9fa205b6c717609edab7eae4ff202a3 | |
parent | 74b1e779383371a020d818330ef1d6beaf0ca22b (diff) | |
parent | 078b8c25ce286558a7cfc09034c4ec4e763165eb (diff) |
Merge pull request #57405 from kleonc/texture_button_focus_only_logic_fix
-rw-r--r-- | scene/gui/texture_button.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index da202c1c8f..89a17ae854 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -173,7 +173,8 @@ void TextureButton::_notification(int p_what) { bool draw_focus = (has_focus() && focused.is_valid()); // If no other texture is valid, try using focused texture. - if (!texdraw.is_valid() && draw_focus) { + bool draw_focus_only = draw_focus && !texdraw.is_valid(); + if (draw_focus_only) { texdraw = focused; } @@ -232,7 +233,7 @@ void TextureButton::_notification(int p_what) { size.width *= hflip ? -1.0f : 1.0f; size.height *= vflip ? -1.0f : 1.0f; - if (texdraw == focused) { + if (draw_focus_only) { // Do nothing, we only needed to calculate the rectangle. } else if (_tile) { draw_texture_rect(texdraw, Rect2(ofs, size), _tile); |