chart.Layout Class
Layout manager for items in a chart
Item Index
Methods
- addChildEvents
- arrangeChildren
- assignDefaultCoordinates
- beforeResize
- clearChildren
- createResizables
- createResizeFunctions
- fixLayoutReferences
- getAlignmentFn
- getChildren
- getDependencies
- getLayoutFn
- getLayoutFnsFor
- getLayoutLayoutFn
- getPropertyFn
- getReference
- getResizableFor
- getResizeFnFor
- getResizerLayout
- getSiblingForResize
- getWronglyArrangedChild
- isArrangedBefore
- isChildResizable
- onNewChild
- positionChild
- prepareResize
- updateLastCoordinatesFor
- updateReferences
Events
Methods
addChildEvents
-
child
Add events to child view
Parameters:
-
child
ludo.View
arrangeChildren
()
private
Before first resize, the internal children array is arranged so that views dependent of other views are resized after the view it's depending on. example: if view "a" has leftOf property set to view "b", then view "b" should be resized and positioned first. This method rearranges the internal children array according to this
assignDefaultCoordinates
-
child
Creates empty newChildCoordinates and lastChildCoordinates for a child view
Parameters:
-
child
ludo.View | ludo.layout.Resizer
beforeResize
-
resize
-
child
Before resize function executed for a resize handle
Parameters:
-
resize
ludo.layout.Resizer -
child
ludo.View
clearChildren
()
private
Clear internal children array. When this is done, resize function will be recreated. This happens when a child is removed or when a new child is added
createResizables
()
private
Create resize handles for resizable children
createResizeFunctions
()
private
Create/Compile resize functions for each child
fixLayoutReferences
()
private
Convert layout id references to direct view reference for optimal performance
getAlignmentFn
-
child
-
alignment
-
property
Return special resize function for the properties alignLeft, alignRight, alignTop and alignBottom
Returns:
getDependencies
-
child
Return all the siblings a child is depending on for layout
Parameters:
-
child
ludo.View
Returns:
getLayoutFn
-
property
-
child
Return one resize function for a child
Parameters:
-
property
String -
child
ludo.View
Returns:
Example:
getLayoutFn(left, view) may return function(){ this.newChildCoordinates[view.id]['left'] = 20; } The resize functions are created before first resize is made. For second resize, the layout functions for each view will simply be called. This is done for optimal performance so that we don't need to calculate more than we have to(Only first time).
getLayoutFnsFor
-
child
Return array of resize function to call when view is resized.
Parameters:
-
child
ludo.View
Returns:
getLayoutLayoutFn
-
child
Final resize function for each child. All the other dynamically created layout function stores values for the left,width,top,bottom, width and height properties. This function call the resize function for each view with the values of these previously set properties
Parameters:
-
child
ludo.View
Returns:
getPropertyFn
-
child
-
property
Returns layout function for the width and height layout properties
Parameters:
-
child
ludo.View -
property
String
Returns:
getReference
-
child
Return direct reference to child
Parameters:
-
child
String | ludo.View
Returns:
getResizableFor
-
child
-
direction
Return resizable handle for a child view
Parameters:
-
child
ludo.View -
direction
String
Returns:
getResizeFnFor
-
child
Return resize function for a child
Parameters:
-
child
ludo.View
Returns:
getResizerLayout
-
child
-
resize
Return layout config for a resize handle
Parameters:
-
child
ludo.View -
resize
String
Returns:
getSiblingForResize
-
child
-
direction
Return sibling which may be affected when a child is resized
Parameters:
-
child
ludo.View -
direction
String
Returns:
getWronglyArrangedChild
()
ludo.View | Undefined
private
Return a child which should be rearrange because it's layout depends on a next sibling
Returns:
isArrangedBefore
-
child
-
of
Returns true if a child is previous sibling of another child
Parameters:
-
child
ludo.View -
of
ludo.View
Returns:
isChildResizable
-
child
Returns true if a child is resizable
Parameters:
-
child
ludo.View
Returns:
onNewChild
-
child
Validate and set required layout properties of new children
Parameters:
-
child
ludo.View
positionChild
-
child
-
property
-
value
Position child at this coordinates
Parameters:
-
child
canvas.Element -
property
String -
value
Number
prepareResize
()
private
No resize done yet, create resize functions
updateLastCoordinatesFor
-
child
Update lastChildCoordinates properties for a child after resize is completed
Parameters:
-
child
ludo.View
updateReferences
-
property
-
child
-
resizer
Update layout references when a resize handle has been created. example: When a resize handle is added to the left of a child view. The leftOf view of this child is now the resize handle and not another view
Parameters:
-
property
String -
child
ludo.View -
resizer
ludo.layout.Resizer
Properties
depKeys
Unknown
private
All the layout options where value is a reference to another child
Events
addChild
Event fired by layout manager when a new child is added
Event Payload:
-
child
ludo.View -
layout
ludo.layout.Basemanager