Dynamic View
Measure and Arrange
Computing the layout in CGI Studio consists of two calls: a measure call and an arrange call. In the measure call the system determines the elements’ size requirements. The parent element tells its child elements how much space is available and the child elements tell their parent elements how much space they require. In the arrange call the layout system finalizes the size and position of the elements.
Sequence diagram for layout computation
For a simple 2D scene with a DefaultLayouter, the sequence of computing the layout is as follows: The RenderLoop (e.g. Courier::RenderJob) calls Scene2D::ValidateLayout(), which triggers a call to the Layouter::Layout(). Then the measure call is started with a call to Layouter::Measure(), that calls DefaultLayouter::OnMeasure(). After that, the arrange call is started with a call to Layouter::Arrange(), that calls DefaultLayouter::OnArrange().