new Frame(options)
Represents the Viewport Frame. The Frame is essentially a DOM element which acts as the
visible portion of the decks system. The Frame is always set to position relative, and
overflow hidden. The Frame contains a Canvas (element), which can move around within the
Frame element. The Frame crops the content of the Canvas at the Frame edges.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Frame options
Properties
|
Mixes In
Methods
-
bind() → {undefined}
-
Binds the Emitter and window events.
Returns:
- Type
- undefined
-
destroy() → {undefined}
-
Destroys the Frame
Returns:
- Type
- undefined
-
getEmitterEvents() → {Object}
-
Gets the Emitter events map.
Returns:
- Type
- Object
-
getWindowEvents() → {Object}
-
Gets the window events map.
Returns:
- Type
- Object
-
isElementVisible(element) → {boolean}
-
Indicates if the given element is currently visible within the Frame's container element. This might be a combination of the element's bounding rect being inside the Frame element, and stacking like z-index.
Parameters:
Name Type Description element
HTMLElement element to check for visibility Returns:
whether the element is visible in the Frame- Type
- boolean
-
onCanvasElementSet(e) → {undefined}
-
Called when the Canvas element has been set. This appends the Canvas element in the Frame element, and also initializes the Canvas with the Frame and Frame bounds.
Parameters:
Name Type Description e
Returns:
- Type
- undefined
-
onDeckResize() → {undefined}
-
Called when a deck:resize event is received. This event is used by the caller to request that the Frame re-calculate it's bounds. If the Frame bounds have changed, it will usually trigger a render cycle in the Viewport.
Returns:
- Type
- undefined
-
onWindowResize() → {undefined}
-
Called on window resize event. Causes the Frame to re-calculate its bounds, which might result in a render cycle in the Viewport.
Returns:
- Type
- undefined
-
onWindowScroll() → {undefined}
-
Called on window scroll event. Causes the Frame to re-calculate its bounds, which might result in a render cycle in the Viewport.
Returns:
- Type
- undefined
-
setBounds(options) → {undefined}
-
Sets the frame size parameters
Parameters:
Name Type Description options
Returns:
- Type
- undefined
-
setConfig(config) → {undefined}
-
Sets the config object.
Parameters:
Name Type Description config
Returns:
- Type
- undefined
-
setElement(element, options) → {undefined}
-
Sets the Frame's DOM element (container)
Parameters:
Name Type Description element
HTMLElement the Frame's main container element options
Object frame options Returns:
- Type
- undefined
-
unbind() → {undefined}
-
Unbinds the Emitter and window events.
Returns:
- Type
- undefined