From 9320266fe89d244b408c3b44bf30502c4acd2995 Mon Sep 17 00:00:00 2001 From: Eric Tuvesson Date: Tue, 27 Oct 2020 23:34:19 +0100 Subject: [PATCH] fix(sprite2d): Rect is not handling pixel snap related https://github.com/godotengine/godot/issues/42985 (cherry picked from commit e892a92ad64144f5d041693385e9173feb2bc7f0) --- scene/2d/sprite.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index a5fbcdfcccc..42eb9f7834a 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -378,6 +378,9 @@ Rect2 Sprite::get_rect() const { Point2 ofs = offset; if (centered) ofs -= Size2(s) / 2; + if (Engine::get_singleton()->get_use_pixel_snap()) { + ofs = ofs.floor(); + } if (s == Size2(0, 0)) s = Size2(1, 1);