Scenic.Primitives.group
group
, go back to Scenic.Primitives module for more information.
Specs
group(source :: Scenic.Graph.t(), builder :: function(), options :: list()) :: Scenic.Graph.t()
Create a new branch in a Graph.
The Group primitive creates a new branch in the Graph's tree. The data field you pass in is a function callback, which allows you to add more primitives inside the new group.
The single parameter to your anonymous callback is a transformed graph that knows to add new primitives to the right branch in the tree.
@graph Graph.build( )
|> text( "Hello World" )
|> group(fn(g) ->
g
|> text( "I'm in the Group" )
end, translate: {40,200})
NOTE: Unlike other primitives, group/3
currently only takes a graph and not
an existing group primitive.
Styles
Groups will accept all styles. They don't use the styles directly, but any styles you set on a group become the new defaults for all primitives you add to that group's branch in the graph.
The :hidden
style is particularly effective when applied to a group as it
causes that entire branch to be drawn, or not.
Transforms
Any transforms you apply to a group are added into the render matrix stack and are applied to all items in that branch, including crossing SceneRefs.