Improvements in loading images

This commit is contained in:
Pieter Vander Vennet 2021-10-01 02:57:41 +02:00
parent 634f4e316a
commit 8b870474d7
9 changed files with 61 additions and 31 deletions

View file

@ -3,6 +3,7 @@ import Attribution from "./Attribution";
import Img from "../Base/Img";
import {ProvidedImage} from "../../Logic/ImageProviders/ImageProvider";
import BaseUIElement from "../BaseUIElement";
import {Mapillary} from "../../Logic/ImageProviders/Mapillary";
export class AttributedImage extends Combine {
@ -10,7 +11,9 @@ export class AttributedImage extends Combine {
constructor(imageInfo: ProvidedImage) {
let img: BaseUIElement;
let attr: BaseUIElement
img = new Img(imageInfo.url);
img = new Img(imageInfo.url, false, {
fallbackImage: imageInfo.provider === Mapillary.singleton ? "./assets/svg/blocked.svg" : undefined
});
attr = new Attribution(imageInfo.provider.GetAttributionFor(imageInfo.url),
imageInfo.provider.SourceIcon(),
)

View file

@ -13,9 +13,7 @@ export class ImageCarousel extends Toggle {
const uiElements = images.map((imageURLS: { key: string, url: string, provider: ImageProvider }[]) => {
const uiElements: BaseUIElement[] = [];
for (const url of imageURLS) {
try {
let image = new AttributedImage(url)
if (url.key !== undefined) {