protected virtual void Reset() { layoutBlock = new CssBoxArea(); layoutPos = new Point2i(); lineHeight = 0; Previous = null; Line = new List <LineBox_Element>(1); Lines = new List <LineBox>(1); }
protected virtual void Add_To_Line(cssElement E, CssBoxArea cArea, Rect2i cSize) { Line.Add(new LineBox_Element(E, new Point2i(layoutPos))); Previous = E; // Now we use the elements CURRENT block size here because if we just used whatever guaranteed value the element can give us then elements with a percentage padding, margin, or size would always overlap their adjacent elements! lineHeight = Math.Max(lineHeight, cSize.Height); // E.Pos.Set_Implicit(layoutPos.X, layoutPos.Y); // Progress our current layout position layoutPos.X += cSize.Width; }
protected virtual void Start_New_Line() { Lines.Add(new LineBox(Line, new Rect2i(layoutPos.X, lineHeight))); Line = new List <LineBox_Element>(1); // Update the width of our layout area int Width = Math.Max(layoutBlock.Width, layoutPos.X); // Update the height of our layout area int Height = Math.Max(layoutBlock.Height, layoutPos.Y + lineHeight); layoutBlock.Set_Dimensions(Width, Height); // Progress our current layout position to the next line layoutPos.X = 0; layoutPos.Y += lineHeight; // Reset the tracked height of this line lineHeight = 0; Previous = null; }
public LineBox_Element(cssElement Element, Point2i Pos) { this.Pos = Pos; this.Element = Element; }