Class: Tile

OpenSeadragon.Tile

new Tile(level, x, y, bounds, exists, url, context2D, loadWithAjax, ajaxHeaders, sourceBounds, postData, cacheKey)

Parameters:
Name Type Description
level Number The zoom level this tile belongs to.
x Number The vector component 'x'.
y Number The vector component 'y'.
bounds OpenSeadragon.Rect Where this tile fits, in normalized coordinates.
exists Boolean Is this tile a part of a sparse image? ( Also has this tile failed to load? )
url String | function The URL of this tile's image or a function that returns a url.
context2D CanvasRenderingContext2D The context2D of this tile if it is provided directly by the tile source.
loadWithAjax Boolean Whether this tile image should be loaded with an AJAX request .
ajaxHeaders Object The headers to send with this tile's AJAX request (if applicable).
sourceBounds OpenSeadragon.Rect The portion of the tile to use as the source of the drawing operation, in pixels. Note that this only works when drawing with canvas; when drawing with HTML the entire tile is always used.
postData String HTTP POST data (usually but not necessarily in k=v&k2=v2... form, see TileSource::getPostData) or null
cacheKey String key to act as a tile cache, must be unique for tiles with unique image data
Source:

Members

ajaxHeaders :Object

The headers to be used in requesting this tile's image. Only used if loadWithAjax is set to true.
Type:
  • Object
Source:

beingDrawn :Boolean

Whether this tile is currently being drawn.
Type:
  • Boolean
Source:

blendStart :Number

The start time of this tile's blending.
Type:
  • Number
Source:

bounds :OpenSeadragon.Rect

Where this tile fits, in normalized coordinates
Type:
Source:

cacheKey :String

The unique cache key for this tile.
Type:
  • String
Source:

context2D :CanvasRenderingContext2D

The context2D of this tile if it is provided directly by the tile source.
Type:
  • CanvasRenderingContext2D
Source:

element :Element

The HTML div element for this tile
Type:
  • Element
Source:

exists :Boolean

Is this tile a part of a sparse image? Also has this tile failed to load?
Type:
  • Boolean
Source:

flipped :Boolean

Whether to flip the tile when rendering.
Type:
  • Boolean
Source:

hasTransparency :Boolean

The transparency indicator of this tile.
Type:
  • Boolean
Source:

image :Object

The Image object for this tile.
Type:
  • Object
Deprecated:
  • Yes
Source:

imgElement :Element

The HTML img element for this tile.
Type:
  • Element
Source:

isBottomMost :Boolean

Whether this tile is in the bottom-most row for its level.
Type:
  • Boolean
Source:

isRightMost :Boolean

Whether this tile is in the right-most column for its level.
Type:
  • Boolean
Source:

lastTouchTime :Number

Timestamp the tile was last touched.
Type:
  • Number
Source:

level :Number

The zoom level this tile belongs to.
Type:
  • Number
Source:

loaded :Boolean

Is this tile loaded?
Type:
  • Boolean
Source:

loading :Boolean

Is this tile loading?
Type:
  • Boolean
Source:

loadWithAjax :Boolean

Whether to load this tile's image with an AJAX request.
Type:
  • Boolean
Source:

opacity :Number

The current opacity this tile should be.
Type:
  • Number
Source:

position :OpenSeadragon.Point

This tile's position on screen, in pixels.
Type:
Source:

postData :String

Post parameters for this tile. For example, it can be an URL-encoded string in k1=v1&k2=v2... format, or a JSON, or a FormData instance... or null if no POST request used
Type:
  • String
Source:

size :OpenSeadragon.Point

This tile's size on screen, in pixels.
Type:
Source:

sourceBounds :OpenSeadragon.Rect

The portion of the tile to use as the source of the drawing operation, in pixels. Note that this only works when drawing with canvas; when drawing with HTML the entire tile is always used.
Type:
Source:

style :String

The alias of this.element.style.
Type:
  • String
Source:

url :String

The URL of this tile's image.
Type:
  • String
Deprecated:
  • Yes
Source:

visibility :Number

The visibility score of this tile.
Type:
  • Number
Source:

x :Number

The vector component 'x'.
Type:
  • Number
Source:

y :Number

The vector component 'y'.
Type:
  • Number
Source:

Methods

drawCanvas(context, drawingHandler, scaleopt, translateopt, shouldRoundPositionAndSizeopt, source)

Renders the tile in a canvas-based context.
Parameters:
Name Type Attributes Default Description
context Canvas
drawingHandler function Method for firing the drawing event. drawingHandler({context, tile, rendered}) where rendered is the context with the pre-drawn image.
scale Number <optional>
1 Apply a scale to position and size
translate OpenSeadragon.Point <optional>
A translation vector
shouldRoundPositionAndSize Boolean <optional>
Tells whether to round position and size of tiles supporting alpha channel in non-transparency context.
source OpenSeadragon.TileSource The source specification of the tile.
Source:

drawHTML(container)

Renders the tile in an html container.
Parameters:
Name Type Description
container Element
Source:

getCanvasContext() → {CanvasRenderingContext2D}

Get the CanvasRenderingContext2D instance for tile image data drawn onto Canvas if enabled and available
Source:
Returns:
Type
CanvasRenderingContext2D

getImage() → {Image}

Get the Image object for this tile.
Source:
Returns:
Type
Image

getScaleForEdgeSmoothing() → {Float}

Get the ratio between current and original size.
Source:
Returns:
Type
Float

getTranslationForEdgeSmoothing(scaleopt) → {OpenSeadragon.Point}

Get a translation vector that when applied to the tile position produces integer coordinates. Needed to avoid swimming and twitching.
Parameters:
Name Type Attributes Default Description
scale Number <optional>
1 Scale to be applied to position.
Source:
Returns:
Type
OpenSeadragon.Point

getUrl() → {String}

Get the url string for this tile.
Source:
Returns:
Type
String

toString() → {String}

Provides a string representation of this tiles level and (x,y) components.
Source:
Returns:
Type
String

unload()

Removes tile from its container.
Source: