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.
This commit is contained in:
William Wall
2018-09-21 08:35:41 -06:00
parent a31453b55f
commit 1da2db83da

View File

@@ -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;
}
}