From cc45c2cdd38cc6e99630bb6e9e677e4920f242c0 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sun, 30 Jun 2024 00:30:42 +0800 Subject: [PATCH] Change GUI controls pixel snap to round halfway to +ve infinity --- scene/gui/control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 0682c11a9b2..e734dab39ab 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -696,7 +696,7 @@ void Control::_update_canvas_item_transform() { // 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(); + xform[2] = (xform[2] + Vector2(0.5, 0.5)).floor(); } RenderingServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform);