Viewer class

The viewer is the abstract base class of all viewers. It provides some basic functionalities and common interfaces.

Signature:

export default abstract class Viewer 

Constructors

ConstructorDescription
(constructor)(containerId, config, width, height)Constructor a viewer.

Properties

PropertyModifiersDescription
_nFramesTobeDrawnNormally
_nFramesTobeDrawnProgressively
state

Methods

MethodDescription
addInput(input)Add an input method to this viewer, e.g., mouse.
addTool(tool)Add an tool to this viewer. Each tool has a unique name/identifier.
destroy()Stop rendering, destroy the viewer and release all internal resources.
getCanvas()Return the canvas DOM.
getHeight()Return the viewer's height.
getInput(id)Get the input method by its id.
getTool(name)Get the tool instance by tool's name.
getWidth()Return the viewer's width.
invalidate(nframesNormally)Invalidate the current rendering and cause rendering to refresh.
isPaused()
isRendering()
isUninitialized()
notifyEventListener(event, args)
pause()Pause the current viewer's internal application update cycle. When paused, the internal update is stopped to save computation. For example, application can call this function when the browser tab is hidden.
registerEventListener(event, response)
removeEventListener(event, response)
removeInput(id)Remove the input method from this viewer.
removeTool(name)Remove the tool object by its name.
resize(width, height)Resize the viewer. This function will be called automatically when browser tab is resized.
resume()Resume the viewer's update cycle.