Show:

Widget extension, which can be used to add responsive support to the base Widget class, through the Base.build method.

Methods

_calculateOriginalDimensions

() Object protected

Calculates the original width and height of the widget, which will be used when changing its dimensions to preserve its ratio.

Returns:

Object:

<p><p><p><p>An object with the original dimensions</p></p></p></p>

_canChangeHeight

() Boolean

Checks if the height can be manually changed.

Returns:

Boolean:

_canChangeWidth

() Boolean

Checks if the width can be manually changed.

Returns:

Boolean:

_defResponsiveFn

(
  • event
)
protected

Default behavior for the responsive event. It updates the dimensions of the widget so it will respect the preserveRatio, maxHeight and maxWidth attributes.

Parameters:

_handleResponsive

() protected

Fires the responsive event.

destructor

() protected

Destructor implementation. Lifecycle.

initializer

() protected

Construction logic executed during instantiation. Lifecycle.

updateDimensions

()

Updates the widget's dimensions so that it will fit the page better.

updateDimensionsWithNewRatio

()

Updates the widget's dimensions like the updateDimensions method, but also recalculates the ratio to be preserved. Useful if the visible content of the widget has changed causing the ratio to change as well.

Attributes

gutter

Array

Vertical and horizontal values in pixels that should not be counted when preserving the widget's ratio. widget.

Default: [0, 0]

maxHeight

Number

The maximum height of the widget.

Default: Infinity

maxWidth

Number

The maximum width of the widget.

Default: Infinity

preserveRatio

Boolean

Flag to indicate if the width/height ratio should be preserved.

Default: true

Events

responsive

Fired when the widget will be updated to be responsive.