From fb330f777ceb0e531699ea0842c0199622114288 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 1 Nov 2020 20:35:45 -0800 Subject: Optimize image loading --- modern/src/map/Map.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js index 2bcf04f4..a718798d 100644 --- a/modern/src/map/Map.js +++ b/modern/src/map/Map.js @@ -37,8 +37,10 @@ const updateReadyValue = value => { const initMap = async () => { const background = await loadImage('images/background.svg'); await Promise.all(deviceCategories.map(async category => { - const imageData = await loadIcon(category, background, `images/icon/${category}.svg`); - if (!map.hasImage(category)) map.addImage(category, imageData, { pixelRatio: window.devicePixelRatio }); + if (!map.hasImage(category)) { + const imageData = await loadIcon(category, background, `images/icon/${category}.svg`); + map.addImage(category, imageData, { pixelRatio: window.devicePixelRatio }); + } })); updateReadyValue(true); }; -- cgit v1.2.3