Class: DrawerBase

OpenSeadragon.DrawerBase

Base class for Drawers that handle rendering of tiles for an OpenSeadragon.Viewer.

Constructor

(abstract) new DrawerBase(options)

Parameters:
Name Type Description
options Object Options for this Drawer.
Properties
Name Type Description
viewer OpenSeadragon.Viewer The Viewer that owns this Drawer.
viewport OpenSeadragon.Viewport Reference to Viewer viewport.
element HTMLElement Parent element.
Source:

Members

defaultOptions

Retrieve default options for the current drawer. The base implementation provides default shared options. Overrides should enumerate all defaults or extend from this implementation. return $.extend({}, super.options, { ... custom drawer instance options ... });
Source:

Methods

(abstract, static) isSupported() → {Boolean}

Source:
Returns:
Whether the drawer implementation is supported by the browser. Must be overridden by extending classes.
Type
Boolean

(abstract) canRotate() → {Boolean}

Source:
Returns:
True if rotation is supported.
Type
Boolean

(abstract) destroy()

Source:

destroyInternalCache()

Destroy internal cache. Should be called within destroy() when usePrivateCache is set to true. Ensures cleanup of anything created by internalCacheCreate(...).
Source:

drawDebuggingRect(rect)

Optional public API to draw a rectangle (e.g. for debugging purposes) Child classes can override this method if they wish to support this
Parameters:
Name Type Description
rect OpenSeadragon.Rect
Source:

getDataToDraw(tile) → {any|undefined}

Check a particular cache record is compatible. This function _MUST_ be called: if it returns a falsey value, the rendering _MUST NOT_ proceed. It should await next animation frames and check again for availability.
Parameters:
Name Type Description
tile OpenSeadragon.Tile
Source:
Returns:
undefined if cache not available, compatible data otherwise.
Type
any | undefined

getId() → {string}

Get unique drawer ID
Source:
Returns:
Type
string

(abstract) getRequiredDataFormats() → {Array.<string>}

Retrieve required data formats the data must be converted to. This list MUST BE A VALID SUBSET OF getSupportedDataFormats()
Source:
Returns:
Type
Array.<string>

(abstract) getSupportedDataFormats() → {Array.<string>}

Retrieve data types
Source:
Returns:
Type
Array.<string>

(abstract) getType() → {String|undefined}

Source:
Returns:
What type of drawer this is. Must be overridden by extending classes.
Type
String | undefined

internalCacheCreate(cache, tile)

If options.usePrivateCache is true, this method MUST RETURN the private cache content
Parameters:
Name Type Description
cache OpenSeadragon.CacheRecord
tile OpenSeadragon.Tile
Source:
Returns:
any

internalCacheFree(data)

It is possible to perform any necessary cleanup on internal cache, necessary if you need to clean up some memory (e.g. destroy canvas by setting with & height to 0).
Parameters:
Name Type Description
data * object returned by internalCacheCreate(...)
Source:

(abstract) setImageSmoothingEnabled(imageSmoothingEnabledopt)

Parameters:
Name Type Attributes Description
imageSmoothingEnabled Boolean <optional>
Whether or not the image is drawn smoothly on the canvas; see imageSmoothingEnabled in OpenSeadragon.Options for more explanation.
Source:

setInternalCacheNeedsRefresh()

Call to invalidate internal cache. It will be rebuilt. With synchronous converions, it will be rebuilt immediatelly. With asynchronous, it will be rebuilt once invalidation routine happens, e.g. you should call also requestInvalidate() if you need to happen it as soon as possible.
Source:

viewportCoordToDrawerCoord(point) → {OpenSeadragon.Point}

This function converts the given point from to the drawer coordinate by multiplying it with the pixel density. This function does not take rotation into account, thus assuming provided point is at 0 degree.
Parameters:
Name Type Description
point OpenSeadragon.Point the pixel point to convert
Source:
Returns:
Point in drawer coordinate system.
Type
OpenSeadragon.Point

viewportToDrawerRectangle(rectangle) → {OpenSeadragon.Rect}

Scale from OpenSeadragon viewer rectangle to drawer rectangle (ignoring rotation)
Parameters:
Name Type Description
rectangle OpenSeadragon.Rect The rectangle in viewport coordinate system.
Source:
Returns:
Rectangle in drawer coordinate system.
Type
OpenSeadragon.Rect