OpenSeadragon.PreviewSlideSource = class extends OpenSeadragon.TileSource {
constructor(options) {
console.assert(options.image instanceof HTMLImageElement, "PreviewSlideSource requires image within the constructor!");
const img = options.image;
options.ready = true;
options.width = img.naturalWidth || img.width || 256;
options.height = img.naturalHeight || img.height || 256;
options.tileWidth = options.width;
options.tileHeight = options.height;
options.minLevel = 0;
options.maxLevel = 0;
super(options);
this.tilesUrl = options.image.src;
}
supports( data, url ){
return false;
}
configure( data, url, postData ){
return {};
}
getTileUrl( level, x, y ) {
return this.tilesUrl;
}
getMetadata() {
return {};
}
tileExists( level, x, y ) {
return level === 0 && x === 0 && y === 0;
}
downloadTileStart(context) {
context.finish(this.image, null, "image");
}
downloadTileAbort(context) {
}
};