public static void AdjustPathForAnimations(PathElement pathElement, SceneEditTransaction editTransaction) { using (pathElement.ViewModel.ForceBaseValue()) { System.Windows.Media.Geometry geometry1 = (System.Windows.Media.Geometry)pathElement.GetLocalOrDefaultValueAsWpf(PathElement.DataProperty); PathGeometry pathGeometry = new PathGeometry(); pathGeometry.AddGeometry(geometry1); Rect bounds = PathCommandHelper.InflateRectByStrokeWidth(pathGeometry.Bounds, pathElement, false); PropertyReference propertyReference = PathCommandHelper.GetPathDataPropertyReference(pathElement.Platform); Rect maxAnimatedExtent = PathCommandHelper.FindMaxAnimatedExtent((SceneElement)pathElement, bounds, propertyReference); double num1 = Math.Min(0.0, maxAnimatedExtent.Left); double num2 = Math.Min(0.0, maxAnimatedExtent.Top); Vector vector = new Vector(-num1, -num2); ILayoutDesigner designerForChild = pathElement.ViewModel.GetLayoutDesignerForChild((SceneElement)pathElement, true); editTransaction.Update(); Rect childRect = designerForChild.GetChildRect((BaseFrameworkElement)pathElement); childRect.X += num1; childRect.Y += num2; childRect.Width = Math.Max(maxAnimatedExtent.Width, childRect.Width); childRect.Height = Math.Max(maxAnimatedExtent.Height, childRect.Height); designerForChild.SetChildRect((BaseFrameworkElement)pathElement, childRect); Transform transform = (Transform) new TranslateTransform(vector.X, vector.Y); PathGeometry geometry2 = PathGeometryUtilities.TransformGeometry((System.Windows.Media.Geometry)pathGeometry, transform); if (!pathElement.DesignerContext.ActiveDocument.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf)) { PathGeometryUtilities.EnsureOnlySingleSegmentsInGeometry(geometry2); } pathElement.PathGeometry = geometry2; PathCommandHelper.TransformPointKeyframes((SceneElement)pathElement, propertyReference, transform); pathElement.SetValueAsWpf(ShapeElement.StretchProperty, (object)(Stretch)(pathElement.HasVertexAnimations ? 0 : 1)); } }