Creates layout container.
Name | Type | Attributes | Description |
---|---|---|---|
options |
LayoutOptions |
<optional> |
Example
const layout = new Layout({
styles: {
width: 100,
height: 100,
background: 'red',
},
content: [
'Hello world',
{
id: 'innerLayout1',
text: 'Inner layout 1',
},
{
id: 'innerLayout2',
text: 'Inner layout 2',
},
],
globalStyles: {
innerLayout1: {
width: 200,
height: 200,
},
innerLayout1: {
width: 200,
height: 200,
},
},
});
Extends
- Container
Members
align AlignController
content ContentController
Returns height of the layouts content.
Returns with of the layouts content.
Set the height of layout.
Get the height of layout.
ID of layout, can be used to set styles in the globalStyles.
ID of layout, can be used to set styles in the globalStyles.
size SizeController
Get SizeController
Layout styles.
Layout text styles.
Set the width of layout.
Get the width of layout.
Methods
Add content to the layout system and reposition/resize elements basing on styles.
Name | Type | Description |
---|---|---|
content |
Content |
Content to be added. Can be string, Container, Layout, LayoutOptions or array of those. Also content can be an object where keys are ids of child layouts to create, and Content as values. |
getChildByID (id) Layout | Container | undefined
Get element from the layout system children tree by it's ID
Name | Type | Description |
---|---|---|
id |
string |
id of the content to be foundS. |
Returns:
Type | Description |
---|---|
Layout | Container | undefined |
Recalculate positions and sizes of layouts three.
Remove content from layout system by its id and reposition/resize elements basing on styles.
Name | Type | Description |
---|---|---|
id |
string |
id of the content to be removed. |
Resize method should be called on every parent size change.
Name | Type | Attributes | Description |
---|---|---|---|
parentWidth |
number |
<optional> |
|
parentHeight |
number |
<optional> |
Updates the layout styles and resize/reposition elements basing on new styles.
Name | Type | Description |
---|---|---|
styles |
Styles |