Merge pull request #9802 from ahocevar/empty-image

Introduce EMPTY image state to deal with images outside the view extent
This commit is contained in:
Andreas Hocevar
2019-07-26 15:35:30 +02:00
committed by GitHub
2 changed files with 3 additions and 5 deletions

View File

@@ -9,5 +9,6 @@ export default {
IDLE: 0,
LOADING: 1,
LOADED: 2,
ERROR: 3
ERROR: 3,
EMPTY: 4
};

View File

@@ -51,10 +51,7 @@ class ReprojImage extends ImageBase {
const sourceExtent = triangulation.calculateSourceExtent();
const sourceImage = getImageFunction(sourceExtent, sourceResolution, pixelRatio);
let state = ImageState.LOADED;
if (sourceImage) {
state = ImageState.IDLE;
}
const state = sourceImage ? ImageState.IDLE : ImageState.EMPTY;
const sourcePixelRatio = sourceImage ? sourceImage.getPixelRatio() : 1;
super(targetExtent, targetResolution, sourcePixelRatio, state);