Layouts.FlexLayout Class
samsara/layouts/FlexLayout.js:25
A layout which arranges items vertically or horizontally within a containing size.
Items with a definite size in the specified direction keep their size, where
items with an undefined
size in the specified direction have a flexible size.
Flexible sized items split up the left over size relative to their flex value.
Constructor
Item Index
Methods
Attributes
Methods
"on"
-
type
-
handler
Adds a handler to the type
channel which will be executed on emit
.
add
-
object
Extends the render tree subtree with a new node.
Parameters:
-
object
SizeNode | LayoutNode | SurfaceNode
Returns:
compose
-
spec
-
parentSpec
-
size
Defines the rules for composing layout specs: transform, align, origin and opacity. Transform is multiplied by the parent's transform (matrix multiplication). Align is a proportional offset relative to the parent size. Origin is a proportional offset relative to the current size. Opacity is multiplied by the parent's opacity.
Parameters:
Returns:
The composed layout spec
get
-
key
Look up options value by key or get the full options hash.
Parameters:
-
key
StringKey
Returns:
Associated object or full options hash
getOptions
-
key
Options getter.
Parameters:
-
key
StringKey
Returns:
object Options value for the key
key
-
key
Return OptionsManager based on sub-object retrieved by key
.
Parameters:
-
key
StringKey
Returns:
Value
off
-
type
-
handler
Removes the handler
from the type
channel.
This undoes the work of on
.
OptionsManager.patch
-
options
-
patch
Constructor method. Create OptionsManager from source dictionary with arguments overridden by patch dictionary.
Parameters:
-
options
ObjectOptions to be patched
-
patch
...ObjectOptions to override
Returns:
source
OptionsManager.setOptions
-
instance
-
options
-
defaults
Constructor method. Convenience method to set options with defaults on an object instance.
Parameters:
Returns:
Patched options
patch
-
options
Patch options with provided patches. Triggers change
event on the object.
Parameters:
-
options
ObjectPatch options
Returns:
this
remove
()
Remove the View from the RenderTree. All Surfaces added to the View will also be removed. The View can be added back at a later time and all of its data and Surfaces will be restored.
set
-
key
-
value
Set key to value. Outputs change
event if a value is overwritten.
Returns:
Updated OptionsManager
setAspectRatio
-
aspectRatio
Setter for aspect ratio.
Parameters:
-
aspectRatio
Number | StreamAspect ratio, or a stream.
setMargins
-
margins
Setter for margins.
Parameters:
-
margins
Number[] | StreamMargins as [x,y], or a stream.
setOrigin
-
origin
Setter for origin.
Parameters:
-
origin
Number[] | StreamOrigin as [x,y], or a stream.
setProportions
-
proportions
Setter for proportions.
Parameters:
-
proportions
Number[] | StreamProportions as [x,y], or a stream.
setSize
-
size
Setter for size.
Parameters:
-
size
Number[] | StreamSize as [width, height] in pixels, or a stream.