ResizingConstraints
On this page
- ResizingConstraints ⇐
Const- ResizingConstraints()
- NONE :
number - PIN_LEFT :
number - PIN_RIGHT :
number - PIN_TOP :
number - PIN_BOTTOM :
number - FIX_WIDTH :
number - FIX_HEIGHT :
number - computeResizing(resizing, parentWidth, $parentWidth, x, width, parentHeight, $parentHeight, y, height) ⇒
Object - computeHorizontalResizing(resizing, parentWidth, $parentWidth, x, width) ⇒
Object
ResizingConstraints ⇐ Const
Kind: global class
Extends: Const
- ResizingConstraints ⇐
Const- new ResizingConstraints()
- .NONE :
number - .PIN_LEFT :
number - .PIN_RIGHT :
number - .PIN_TOP :
number - .PIN_BOTTOM :
number - .FIX_WIDTH :
number - .FIX_HEIGHT :
number - .computeResizing(resizing, parentWidth, $parentWidth, x, width, parentHeight, $parentHeight, y, height) ⇒
Object - .computeHorizontalResizing(resizing, parentWidth, $parentWidth, x, width) ⇒
Object
ResizingConstraints()
Available constraints to be used when resizing a view. (Inspired by Sketch’s resizing constraints)
NONE : number
No constraint
Kind: static constant of ResizingConstraints
PIN_LEFT : number
Pin view to left edge on resize
Kind: static constant of ResizingConstraints
PIN_RIGHT : number
Pin view to right edge on resize
Kind: static constant of ResizingConstraints
PIN_TOP : number
Pin view to top edge on resize
Kind: static constant of ResizingConstraints
PIN_BOTTOM : number
Pin view to bottom edge on resize
Kind: static constant of ResizingConstraints
FIX_WIDTH : number
Fix the width of the view on resize
Kind: static constant of ResizingConstraints
FIX_HEIGHT : number
Fix the height of the view on resize
Kind: static constant of ResizingConstraints
computeResizing(resizing, parentWidth, $parentWidth, x, width, parentHeight, $parentHeight, y, height) ⇒ Object
Compute the real position/dimension for the targeted device, depending on resizing constraints.
Kind: static method of ResizingConstraints
Returns: Object - A JavaScript map object holding $x, $width, $ratioX, $y, $height, $ratioY computed values.
| Param | Type | Description |
|---|---|---|
| resizing | number | The resizing constraint(s), can be a combination: PIN_TOP + FIX_WIDTH for example |
| parentWidth | number | The width of the view container |
| $parentWidth | number | The computed width of the view container |
| x | number | The x coordinate of the view |
| width | number | The width of the view |
| parentHeight | number | The height of the view container |
| $parentHeight | number | The computed height of the view container |
| y | number | The y coordinate of the view |
| height | number | The height of the view |
computeHorizontalResizing(resizing, parentWidth, $parentWidth, x, width) ⇒ Object
Compute the left position and the width dimension depending on the resizing constraints.
Remark: if FIX_WIDTH + PIN_RIGHT + PIN_LEFT is not a possible value for resizing, it will throw an error
Kind: static method of ResizingConstraints
Returns: Object - A JavaScript map object holding $x, $width, $ratioX computed values.
| Param | Type | Description |
|---|---|---|
| resizing | number | The resizing constraint(s), can be a combination: PIN_LEFT + FIX_WIDTH for example |
| parentWidth | number | The width of the view container |
| $parentWidth | number | The computed width of the view container |
| x | number | The x coordinate of the view |
| width | number | The width of the view |