Selaa lähdekoodia

Fix jitter in control nodes when using pivot-offset and animating scale

This is based on suggested fix from this comment
https://github.com/godotengine/godot/issues/36087#issuecomment-771593146 -- basically the old rounding workaround is removed, and rounding is now done locally in the scroll_container instead.

Fixes #28804

Co-authored-by: Georg Wacker <[email protected]>
asheraryam 4 vuotta sitten
vanhempi
commit
25f35b2c9f
2 muutettua tiedostoa jossa 1 lisäystä ja 5 poistoa
  1. 0 5
      scene/gui/control.cpp
  2. 1 0
      scene/gui/scroll_container.cpp

+ 0 - 5
scene/gui/control.cpp

@@ -462,11 +462,6 @@ void Control::_update_canvas_item_transform() {
 	Transform2D xform = _get_internal_transform();
 	Transform2D xform = _get_internal_transform();
 	xform[2] += get_position();
 	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();
-	}
-
 	VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform);
 	VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform);
 }
 }
 
 

+ 1 - 0
scene/gui/scroll_container.cpp

@@ -315,6 +315,7 @@ void ScrollContainer::_notification(int p_what) {
 					r.size.height = minsize.height;
 					r.size.height = minsize.height;
 			}
 			}
 			r.position += ofs;
 			r.position += ofs;
+			r.position = r.position.floor();
 			fit_child_in_rect(c, r);
 			fit_child_in_rect(c, r);
 		}
 		}