LayoutOMatic.ComponentLayout (Scenic Layout-O-Matic v0.6.0)
Handles Auto-Layouts for Scenic Components.
Each Scenic component is a little different in how it's sized and positioned. While most components are positioned from it's top left most point, passing the next starting point is a little different. Sizing for components are based on font metrics. By determining the dimensions of the font, width and height are calculated and applied to the component. The Layout-O-Matic takes care of all of this for you. Width and height can also be passed as style arguments on a component in which case those dimensions will be used.
Auto-Layout, while a made up term, is used to describe that components will be automatically laid out by positioning components in equal rows and columns. Possibly in the future there may be other types of layouts.
Layout takes data like the component, starting {x,y}, grid {x,y}, graph which are required to do any autolayouting. Optionally layout can apply padding to a group which will pad the groups elements
within the groups grid. Options here include: :padding-top, :padding-right, :padding-bottom, :padding-left. These are followed by an integer representing the number of pixels to pad by.
Percentages are not currently supported. This also supports padding shorthand: {10, 10, 5} which will apply 10 px padding to the top and right and left then 5 px to the bottom. With this pattern
a single value will apply to all sides.
To achieve something which mimics a fixed position, use a separate grid or scene which occupies that space of the viewport and use the max {x, y} of that grid/scene and the min {x, y} for every subsequent scene.
Objects can be positioned relative to other elements by using passing :absolute, <group_id_to_position_relative_to>, {top_pixels, right_pixels, bottom_pixels, left_pixels}`
Link to this section Summary
Link to this section Functions
auto_layout(graph, group_id, list_of_comp_ids)
Specs
auto_layout(Scenic.Graph.t(), atom(), [atom()]) :: {:ok, Scenic.Graph.t()}