mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 21:26:10 +03:00
Simplify filtering plugin demo.
This commit is contained in:
parent
29b01cf1bd
commit
63180a1589
@ -321,7 +321,6 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
||||
});
|
||||
|
||||
$.Promise.all(tileList.map(tile => {
|
||||
tile.AAAAAAA = new Date().toISOString();
|
||||
if (restoreTiles) {
|
||||
tile.restore();
|
||||
}
|
||||
|
@ -54,8 +54,8 @@
|
||||
const self = this;
|
||||
this.viewer = options.viewer;
|
||||
|
||||
this.viewer.addHandler('tile-loaded', tileLoadedHandler);
|
||||
this.viewer.addHandler('tile-invalidated', tileUpdateHandler);
|
||||
this.viewer.addHandler('tile-loaded', applyFilters);
|
||||
this.viewer.addHandler('tile-invalidated', applyFilters);
|
||||
|
||||
// filterIncrement allows to determine whether a tile contains the
|
||||
// latest filters results.
|
||||
@ -63,26 +63,12 @@
|
||||
|
||||
setOptions(this, options);
|
||||
|
||||
async function tileLoadedHandler(event) {
|
||||
await applyFilters(event.tile, event.tiledImage);
|
||||
}
|
||||
|
||||
function tileUpdateHandler(event) {
|
||||
const tile = event.tile;
|
||||
const incrementCount = tile._filterIncrement;
|
||||
if (incrementCount === self.filterIncrement) {
|
||||
//we _know_ we have up-to-date data to render
|
||||
return;
|
||||
}
|
||||
//go async otherwise
|
||||
return applyFilters(tile, event.tiledImage);
|
||||
}
|
||||
|
||||
async function applyFilters(tile, tiledImage) {
|
||||
const processors = getFiltersProcessors(self, tiledImage);
|
||||
async function applyFilters(e) {
|
||||
const tile = e.tile,
|
||||
tiledImage = e.tiledImage,
|
||||
processors = getFiltersProcessors(self, tiledImage);
|
||||
|
||||
if (processors.length === 0) {
|
||||
tile._filterIncrement = self.filterIncrement;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user