Class: DrawerBase

OpenSeadragon.DrawerBase

Base class for Drawers that handle rendering of tiles for an OpenSeadragon.Viewer. More viewers can be implemented even as plugins if they are attached to the OpenSeadragon namespace. Then you can employ the newly defined type as you would do with built-in drawers.

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:

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

destroy()

Destroy the drawer. Child classes must call this super class.
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:

getId() → {string}

Get unique drawer ID
Source:
Returns:
Type
string

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:

tiledImageCreated(tiledImage)

When a Tiled Image is initialized and ready, this method is called. Unlike with events, here it is guaranteed that all external code has finished processing (under normal circumstances) and the tiled image should not change.
Parameters:
Name Type Description
tiledImage OpenSeadragon.TiledImage target image that has been created
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