From 1da2db83dabc49e0179151641d317430691ff2b4 Mon Sep 17 00:00:00 2001 From: William Wall Date: Fri, 21 Sep 2018 08:35:41 -0600 Subject: [PATCH] Fix type check errors for Image source The parent class does not accept an extent on its options. Also check that the image is an img or video tag before setting the source as Canvas does not have the src property. --- src/ol/source/Image.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index cefb3ab451..669378e96a 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -91,7 +91,6 @@ class ImageSource extends Source { constructor(options) { super({ attributions: options.attributions, - extent: options.extent, projection: options.projection, state: options.state }); @@ -232,7 +231,10 @@ class ImageSource extends Source { * @param {string} src Source. */ export function defaultImageLoadFunction(image, src) { - image.getImage().src = src; + const img = image.getImage(); + if (img instanceof HTMLImageElement || img instanceof HTMLVideoElement) { + img.src = src; + } }