Class: HTMLDrawer

OpenSeadragon.HTMLDrawer

HTML-based implementation of DrawerBase for an OpenSeadragon.Viewer.

Constructor

new HTMLDrawer(options)

Parameters:
Name Type Description
options Object Options for this Drawer.
Properties
Name Type Attributes Description
viewer OpenSeadragon.Viewer The Viewer that owns this Drawer.
viewport OpenSeadragon.Viewport Reference to Viewer viewport.
element Element Parent element.
debugGridColor Number <optional>
See debugGridColor in OpenSeadragon.Options for details.
Source:

Extends

Members

canvas :Element

The HTML element (div) that this drawer uses for drawing
Type:
  • Element
Source:

container :Element

The parent element of this Drawer instance, passed in when the Drawer was created. The parent of OpenSeadragon.WebGLDrawer#canvas.
Type:
  • Element
Source:

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 ... });
Inherited From:
Source:

Methods

(abstract) canRotate() → {Boolean}

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

(abstract) destroy()

Inherited From:
Source:

destroyInternalCache()

Destroy internal cache. Should be called within destroy() when usePrivateCache is set to true. Ensures cleanup of anything created by internalCacheCreate(...).
Inherited From:
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
Inherited From:
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
Inherited From:
Source:
Returns:
undefined if cache not available, compatible data otherwise.
Type
any | undefined

getId() → {string}

Get unique drawer ID
Inherited From:
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()
Inherited From:
Source:
Returns:
Type
Array.<string>

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

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

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

Inherited From:
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
Inherited From:
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(...)
Inherited From:
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.
Inherited From:
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.
Inherited From:
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
Inherited From:
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.
Inherited From:
Source:
Returns:
Rectangle in drawer coordinate system.
Type
OpenSeadragon.Rect