diff options
Diffstat (limited to 'scene/2d/sprite_2d.cpp')
-rw-r--r-- | scene/2d/sprite_2d.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index 5178d2f850..a065565a0f 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -99,7 +99,8 @@ void Sprite2D::_get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_c if (centered) { dest_offset -= frame_size / 2; } - if (Engine::get_singleton()->get_use_pixel_snap()) { + + if (get_viewport() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) { dest_offset = dest_offset.floor(); } @@ -367,6 +368,10 @@ Rect2 Sprite2D::get_rect() const { ofs -= Size2(s) / 2; } + if (get_viewport() && get_viewport()->is_snap_2d_transforms_to_pixel_enabled()) { + ofs = ofs.floor(); + } + if (s == Size2(0, 0)) { s = Size2(1, 1); } |