Merge pull request #37615 from guilhermefelipecgs/fix_37526
Fix TextureRect::flip_* when used with atlas texture
This commit is contained in:
commit
5d82fa74d9
|
@ -95,6 +95,15 @@ void TextureRect::_notification(int p_what) {
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<AtlasTexture> p_atlas = texture;
|
||||||
|
|
||||||
|
if (p_atlas.is_valid() && region.has_no_area()) {
|
||||||
|
Size2 scale_size(size.width / texture->get_width(), size.height / texture->get_height());
|
||||||
|
|
||||||
|
offset.width += hflip ? p_atlas->get_margin().get_position().width * scale_size.width * 2 : 0;
|
||||||
|
offset.height += vflip ? p_atlas->get_margin().get_position().height * scale_size.height * 2 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue