Class: Canvas

Canvas

new Canvas(options)

Canvas - manages the main DOM element in which items are rendered, and where UI/touch/gesture events are first handled.
Parameters:
Name Type Description
options Object additional options
Source:

Mixes In

Members

defaultGestureHandlerOptions

Default options for the canvas GestureHandler
Source:

defaultOptions

Default Canvas constructor options
Source:

Methods

addRender(render) → {undefined}

Adds a render (element) to the canvas, if not already added
Parameters:
Name Type Description
render Object render to remove
Source:
Returns:
Type
undefined

bind() → {undefined}

Binds Canvas event handlers.
Source:
Returns:
Type
undefined

bindGestures() → {undefined}

Binds the GestureHandler managed by the Canvas
Source:
Returns:
Type
undefined

configureGestures() → {undefined}

Configures the Canvas GestureHandler options. This is used to configure how the user can interact with the canvas through touch gestures, or natural scrolling, and other Hammer.js or DOM events. The Canvas specifies default options, which can be overridden via Layout#getCanvasGestureOptions per Layout.
Source:
Returns:
Type
undefined

destroy() → {undefined}

Destroys the Canvas
Source:
Returns:
Type
undefined

getEmitterEvents()

Events to bind to on the main emitter
Source:

getRenderElements() → {HTMLElement[]}

Gets the .decks-item elements inside the canvas as plain array.
Source:
Returns:
Type
HTMLElement[]

getRenderElementsBounds() → {Object}

Gets a rect that is the union of all the bounding client rects for all render elements.
Source:
Returns:
- the union of all element rects, or null if there are no elements.
Type
Object

getWindowEvents()

Events to bind to on the window
Source:

panToElement(element) → {undefined}

Moves the Canvas to bring the specified element into view. This is handled by GestureHandler#animateMoveToElement
Parameters:
Name Type Description
element
Source:
Returns:
Type
undefined

removeRender(render) → {undefined}

Removes a render (element) from the Canvas, if present.
Parameters:
Name Type Description
render Object render to remove
Source:
Returns:
Type
undefined

resetPosition() → {undefined}

Resets the postiion of the Canvas (top/left or scrollTop/scrollLeft) to the default position (0, 0). This is handled by GestureHandler#resetPosition
Source:
Returns:
Type
undefined

resizeToFitAllElements() → {undefined}

Resizes the canvas to fit all of the .decks-item elements currently in the Canvas.
Source:
Returns:
Type
undefined

resizeToFitElement(element) → {undefined}

Resizes the Canvas to fit the specified Element.
Parameters:
Name Type Description
element
Source:
Returns:
Type
undefined

setAnimator(animator) → {undefined}

Sets the animator instance
Parameters:
Name Type Description
animator
Source:
Returns:
Type
undefined

setBounds(bounds) → {undefined}

Sets the bounds of the Canvas (width and height). This uses the Layout#getCanvasBoundsOptions to apply some post-processing to the bounds. E.g. if the Layout wants extra padding at the right or bottom, or wants to prevent overflow (so the Canvas doesn't create vertical or horizontal scrollbars on the Frame).
Parameters:
Name Type Description
bounds
Source:
Returns:
Type
undefined

setConfig(config) → {undefined}

Sets the config object
Parameters:
Name Type Description
config
Source:
Returns:
Type
undefined

setElement(element, options) → {undefined}

Sets the main container element, where items are rendered. Creates a div if no element is provided
Parameters:
Name Type Argument Description
element HTMLElement <nullable>
element for the container
options Object <nullable>
additional options
Source:
Returns:
Type
undefined

setFrame(frame) → {undefined}

Sets the Frame instance on the Canvas
Parameters:
Name Type Description
frame
Source:
Returns:
Type
undefined

setFrameBounds(frameBounds) → {undefined}

Sets the Frame bounds
Parameters:
Name Type Description
frameBounds
Source:
Returns:
Type
undefined

setLayout(layout) → {undefined}

Sets the Layout instance, and reconfigures the Canvas based on Layout options
Parameters:
Name Type Description
layout
Source:
Returns:
Type
undefined

unbind() → {undefined}

Unbinds Canvas event handlers.
Source:
Returns:
Type
undefined

unbindGestures() → {undefined}

Unbinds the GestureHandler managed by the Canvas
Source:
Returns:
Type
undefined