diff options
author | kleonc <9283098+kleonc@users.noreply.github.com> | 2022-01-29 16:00:30 +0100 |
---|---|---|
committer | kleonc <9283098+kleonc@users.noreply.github.com> | 2022-01-29 16:00:30 +0100 |
commit | 078b8c25ce286558a7cfc09034c4ec4e763165eb (patch) | |
tree | 0c21f2500da8e46db6a5127106b7de7118adcd8b | |
parent | 2f57a11ed9b383706b72783c0d9b1e869774e08a (diff) |
TextureButton Fix logic for drawing only the focus texture
-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); |