Beispiel #1
0
 public Line(LineProps props, params IElement <IElementState>[] children)
 {
     if (props == null)
     {
         throw new InvalidOperationException();
     }
     this.Children = children;
     this.Props    = props;
 }
Beispiel #2
0
        public LineState(LineState existing, Line e, RenderContext context)
        {
            props = e.Props;
            var bounds = context.Bounds;

            nestedElementStates = e.Children.Select((elem, index) =>
            {
                var result = elem?.Update(existing?.nestedElementStates?[index], context.WithBounds(bounds));
                if (result != null)
                {
                    bounds = bounds.Remaining(e.Props.Direction, result.BoundingBox);
                }
                return(result);
            }).ToList();

            BoundingBox = context.Bounds.Sum(e.Props.Direction, nestedElementStates.Where(p => p != null).Select(p => p.BoundingBox));
        }