ResizingConstraints

ResizingConstraints ⇐ Const

Kind: global class
Extends: Const

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.

ParamTypeDescription
resizingnumber

The resizing constraint(s), can be a combination: PIN_TOP + FIX_WIDTH for example

parentWidthnumber

The width of the view container

$parentWidthnumber

The computed width of the view container

xnumber

The x coordinate of the view

widthnumber

The width of the view

parentHeightnumber

The height of the view container

$parentHeightnumber

The computed height of the view container

ynumber

The y coordinate of the view

heightnumber

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.

ParamTypeDescription
resizingnumber

The resizing constraint(s), can be a combination: PIN_LEFT + FIX_WIDTH for example

parentWidthnumber

The width of the view container

$parentWidthnumber

The computed width of the view container

xnumber

The x coordinate of the view

widthnumber

The width of the view