public void Update(Rectangle area) { rectProjector = new ViewRectProjector(viewWidget, area); var viewProjectors = new List <ViewProjector>(); Process(viewWidget, viewProjectors); imageCombinerStack.Clear(); }
private static ContentSizeComponent ProcessWidget(Widget widget, Dictionary <Node, ContentSizeComponent> children) { var animationDuration = 0; foreach (var child in widget.Nodes) { foreach (var animator in child.Animators) { animationDuration = Math.Max(animationDuration, animator.Duration); } } var animationFrame = widget.DefaultAnimation.Frame; var projector = new ViewRectProjector(widget, Rectangle.Empty); var aabb = new Rectangle(float.MaxValue, float.MaxValue, float.MinValue, float.MinValue); var isEmpty = true; for (var frame = 0; frame <= animationDuration; frame++) { widget.DefaultAnimation.Frame = frame; widget.Update(0); foreach (var child in children) { var childWidget = (Widget)child.Key; if (!childWidget.Visible || childWidget.Color.A == 0) { continue; } isEmpty = false; var size = child.Value.Size.ForProjection(child.Key); size = projector.Project(child.Key, size); var childAabb = ((ContentRectangle)size).Data; aabb = Rectangle.Bounds(aabb, childAabb); } } widget.DefaultAnimation.Frame = animationFrame; if (isEmpty) { return(ProcessEmptyNode(widget)); } var selfSize = widget.Components.GetOrAdd <ContentSizeComponent>(); selfSize.Size = new ContentRectangle(aabb, Vector2.One / widget.Size); return(selfSize); }