Seadragon.Drawer class

Version - Back to Seadragon Ajax Library

Overview

This class handles and encapsulates the rendering of Seadragon content. It also provides support for overlays, which are HTML elements that are rendered on top of the content.

Currently, the Drawer supports two rendering methods: the first uses regular <img> elements, while the second uses the HTML 5 <canvas> element. The rendering method used for a given browser is determined by browser capability and rendering quality.

Constructors

Signature Description
Seadragon.Drawer(source, viewport, elmt) Creates a Drawer for the given Seadragon.TileSource, in the given Seadragon.Viewport, inside the given HTML element.

Properties

All properties are aliased; re-assigning them has no effect, but modifying them does.

Name Type Description
elmt HTML Element The HTML element inside which the content is rendered. This is the same HTML element that is passed into the constructor. The specifics of this element and its children are unspecified and implementation-dependent.
profiler Seadragon.Profiler A Seadragon.Profiler instance that is profiling each update.

Methods

Overlays

Name and Signature Return Type Description
addOverlay(elmt, rect) - Adds the given HTML element as an overlay to the content if it has not been added before. This overlay will scale with the content; the element's size will always match the given Seadragon.Rect, which must be in normalized coordinates (see Seadragon.Viewport for details).
addOverlay(elmt, point, placement?) - Adds the given HTML element as an overlay to the content if it has not been added before. This overlay will not scale with the content; its size will remain untouched. The overlay will be placed at the given Seadragon.Point, which must be a normalized coordinate (see Seadragon.Viewport for details). An optional Seadragon.OverlayPlacement value can be given that describes which part of the element is specifically placed at the given point. If none is given, the element is placed by its center.
updateOverlay(elmt, rect) - Updates the given HTML element overlay to the given Seadragon.Rect. The overlay will scale with the content.
updateOverlay(elmt, point, placement?) - Updates the given HTML element overlay to the given Seadragon.Point. and optionally the given Seadragon.OverlayPlacement. If no placement is given, the element is placed by its center. The overlay will not scale with the content.
removeOverlay(elmt) - Removes the given HTML element overlay.
clearOverlays() - Removes all HTML element overlays.

Drawing

Name and Signature Return Type Description
needsUpdate() Boolean Returns true if the drawer needs an update since the last update.
reset() - Resets this drawer so that the content is re-drawn from scratch. Overlays are maintained, however.
update() - Updates the drawn content based on the viewport's current values.