summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-01-31 13:45:52 +0100
committerGitHub <noreply@github.com>2022-01-31 13:45:52 +0100
commitbe60e04639dbf906d5b38947b670ac5d8da16182 (patch)
tree47745f820de4026a30971397614595866d6ae979 /scene
parent2c85f2a8f60d691c126f87f9cd831d50d272e499 (diff)
parente1148cc452c1a627974d5d63e95cfc12bf6fa319 (diff)
Merge pull request #57481 from bruvzg/restore_snap_controls_to_pixels
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/control.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 562ea8a8f7..7ebc5c27f8 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -576,6 +576,11 @@ void Control::_update_canvas_item_transform() {
Transform2D xform = _get_internal_transform();
xform[2] += get_position();
+ // We use a little workaround to avoid flickering when moving the pivot with _edit_set_pivot()
+ if (is_inside_tree() && Math::abs(Math::sin(data.rotation * 4.0f)) < 0.00001f && get_viewport()->is_snap_controls_to_pixels_enabled()) {
+ xform[2] = xform[2].round();
+ }
+
RenderingServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform);
}