mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
TextureButton Fix logic for drawing only the focus texture
This commit is contained in:
parent
2f57a11ed9
commit
078b8c25ce
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user