summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-10-28 10:16:34 +0100
committerGitHub <noreply@github.com>2020-10-28 10:16:34 +0100
commit6328f7a45c662a4ee05217c88df0d80e7525f2bb (patch)
tree15c4ce38fbe03e7903e2a1c0a68029159c76b666
parent45da7d579a1fd39b2a5c06947a4cb961a9b33fc4 (diff)
parente892a92ad64144f5d041693385e9173feb2bc7f0 (diff)
Merge pull request #43147 from Mallos/fix/sprite2d-rect
fix(sprite2d): Rect is not handling pixel snap
-rw-r--r--scene/2d/sprite_2d.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp
index 5178d2f850..c795ce9cf7 100644
--- a/scene/2d/sprite_2d.cpp
+++ b/scene/2d/sprite_2d.cpp
@@ -366,6 +366,9 @@ Rect2 Sprite2D::get_rect() const {
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);