Merge pull request #17341 from poke1024/fix16461
Fix unselectable flipped sprites (fixes 16461)
This commit is contained in:
commit
079b919b41
@ -281,11 +281,17 @@ bool Sprite::_edit_is_selected_on_click(const Point2 &p_point, double p_toleranc
|
|||||||
Rect2 src_rect, dst_rect;
|
Rect2 src_rect, dst_rect;
|
||||||
bool filter_clip;
|
bool filter_clip;
|
||||||
_get_rects(src_rect, dst_rect, filter_clip);
|
_get_rects(src_rect, dst_rect, filter_clip);
|
||||||
|
dst_rect.size = dst_rect.size.abs();
|
||||||
|
|
||||||
if (!dst_rect.has_point(p_point))
|
if (!dst_rect.has_point(p_point))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Vector2 q = ((p_point - dst_rect.position) / dst_rect.size) * src_rect.size + src_rect.position;
|
Vector2 q = (p_point - dst_rect.position) / dst_rect.size;
|
||||||
|
if (hflip)
|
||||||
|
q.x = 1.0f - q.x;
|
||||||
|
if (vflip)
|
||||||
|
q.y = 1.0f - q.y;
|
||||||
|
q = q * src_rect.size + src_rect.position;
|
||||||
|
|
||||||
Ref<Image> image;
|
Ref<Image> image;
|
||||||
Ref<AtlasTexture> atlasTexture = texture;
|
Ref<AtlasTexture> atlasTexture = texture;
|
||||||
|
Loading…
Reference in New Issue
Block a user