mirror of
https://github.com/godotengine/godot.git
synced 2025-04-25 01:48:08 +08:00
Merge pull request #57405 from kleonc/texture_button_focus_only_logic_fix
This commit is contained in:
commit
7da9e31f66
@ -173,7 +173,8 @@ void TextureButton::_notification(int p_what) {
|
|||||||
bool draw_focus = (has_focus() && focused.is_valid());
|
bool draw_focus = (has_focus() && focused.is_valid());
|
||||||
|
|
||||||
// If no other texture is valid, try using focused texture.
|
// 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;
|
texdraw = focused;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +233,7 @@ void TextureButton::_notification(int p_what) {
|
|||||||
size.width *= hflip ? -1.0f : 1.0f;
|
size.width *= hflip ? -1.0f : 1.0f;
|
||||||
size.height *= vflip ? -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.
|
// Do nothing, we only needed to calculate the rectangle.
|
||||||
} else if (_tile) {
|
} else if (_tile) {
|
||||||
draw_texture_rect(texdraw, Rect2(ofs, size), _tile);
|
draw_texture_rect(texdraw, Rect2(ofs, size), _tile);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user