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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user