new Tile(level, x, y, bounds, exists, url, context2Dopt, loadWithAjax, ajaxHeaders, sourceBounds, postData, cacheKey)
Parameters:
| Name | Type | Attributes | 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 |
<optional> |
The context2D of this tile if it * is provided directly by the tile source. Deprecated: use Tile::addCache(...) instead. |
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::getTilePostData) 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:
cacheImageRecord :OpenSeadragon.CacheRecord
The default cache for this tile.
Type:
- Deprecated:
- Yes
- Source:
cacheImageRecord
The default cache for this tile.
- Deprecated:
- Yes
- Source:
cacheKey :String
The unique main cache key for this tile. Created automatically
from the given tiledImage.source.getTileHashKey(...) implementation.
Type:
- String
- Source:
context2D :CanvasRenderingContext2D
The context2D of this tile if it is provided directly by the tile source.
Type:
- CanvasRenderingContext2D
- Source:
context2D :CanvasRenderingContext2D
The context2D of this tile if it is provided directly by the tile source.
Type:
- CanvasRenderingContext2D
- Deprecated:
- Yes
- Source:
context2D
The context2D of this tile if it is provided directly by the tile source.
- Deprecated:
- Yes
- Source:
element :Element
The HTML div element for this tile
Type:
- Element
- Deprecated:
- Yes
- 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
- Deprecated:
- Yes
- 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:
originalCacheKey :String
By default equal to tile.cacheKey, marks a cache associated with this tile
that holds the cache original data (it was loaded with). In case you
change the tile data, the tile original data should be left with the cache
'originalCacheKey' and the new, modified data should be stored in cache 'cacheKey'.
This key is used in cache resolution: in case new tile data is requested, if
this cache key exists in the cache it is loaded.
Type:
- String
- Source:
position :OpenSeadragon.Point
This tile's position on screen, in pixels.
Type:
- Source:
positionedBounds :OpenSeadragon.Rect
Where this tile fits, in normalized coordinates, after positioning
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
- Deprecated:
- Yes
- 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
addCache(key, data, typeopt, setAsMainopt, _safelyopt) → {OpenSeadragon.CacheRecord|null}
Create tile cache for given data object.
Using `setAsMain` updates also main tile cache key - the main cache key used to draw this tile.
In that case, the cache should be ready to be rendered immediatelly (converted to one of the supported formats
of the currently employed drawer).
NOTE: if the existing cache already exists,
data parameter is ignored and inherited from the existing cache object.
WARNING: if you override main tile cache key to point to a different cache, the invalidation routine
will no longer work. If you need to modify tile main data, prefer to use invalidation routine instead.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
key |
string | cache key, if unique, new cache object is created, else existing cache attached | ||
data |
* | this data will be IGNORED if cache already exists; therefore if `typeof data === 'function'` holds (both async and normal functions), the data is called to obtain the data item: this is an optimization to load data only when necessary. | ||
type |
string |
<optional> |
data type, will be guessed if not provided (not recommended), if data is a callback the type is a mandatory field, not setting it results in undefined behaviour | |
setAsMain |
boolean |
<optional> |
false | if true, the key will be set as the tile.cacheKey, no effect if key === this.cacheKey |
_safely |
<optional> |
true | private |
- Source:
Returns:
- The cache record the tile was attached to.
- Type
- OpenSeadragon.CacheRecord | null
equals(tile)
Check if two tiles are data-equal
Parameters:
| Name | Type | Description |
|---|---|---|
tile |
OpenSeadragon.Tile |
- Source:
getCache(keyopt) → {OpenSeadragon.CacheRecord}
Read tile cache data object (CacheRecord)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
key |
string |
<optional> |
this.cacheKey | cache key to read that belongs to this tile |
- Source:
Returns:
getCacheSize() → {number}
Get the number of caches available to this tile
- Source:
Returns:
number of caches
- Type
- number
getCanvasContext() → {CanvasRenderingContext2D|undefined}
Get the CanvasRenderingContext2D instance for tile image data drawn
onto Canvas if enabled and available
- Source:
Returns:
- Type
- CanvasRenderingContext2D | undefined
getImage() → (nullable) {Image}
Get the Image object for this tile.
- Source:
Returns:
- Type
- Image
getScaleForEdgeSmoothing() → {number}
Get the ratio between current and original size.
- Deprecated:
- Yes
- Source:
Returns:
- Type
- number
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
removeCache(key, freeIfUnusedopt) → {OpenSeadragon.CacheRecord|undefined}
Free tile cache. Removes by default the cache record if no other tile uses it.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
key |
string | cache key, required | ||
freeIfUnused |
boolean |
<optional> |
true | set to false if zombie should be created |
- Source:
Returns:
reference to the cache record if it was removed,
undefined if removal was refused to perform (e.g. does not exist, it is an original data target etc.)
- Type
- OpenSeadragon.CacheRecord | undefined
setCache(key, cache, setAsMainopt, _safelyopt) → {OpenSeadragon.CacheRecord|null}
Add cache object to the tile
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
key |
string | cache key, if unique, new cache object is created, else existing cache attached | ||
cache |
OpenSeadragon.CacheRecord | the cache object to attach to this tile | ||
setAsMain |
boolean |
<optional> |
false | if true, the key will be set as the tile.cacheKey, no effect if key === this.cacheKey |
_safely |
<optional> |
true | private |
- Source:
Returns:
- Returns cache parameter reference if attached.
- Type
- OpenSeadragon.CacheRecord | null
toString() → {String}
Provides a string representation of this tiles level and (x,y)
components.
- Source:
Returns:
- Type
- String
unload(eraseopt)
Removes tile from the system: it will still be present in the
OSD memory, but marked as loaded=false, and its data will be erased.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
erase |
boolean |
<optional> |
false |
- Source: