aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-01 20:35:45 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-01 20:35:45 -0800
commitfb330f777ceb0e531699ea0842c0199622114288 (patch)
tree951c9d514be9e3984d74490cd3c08be5c75321d2 /modern/src
parenta20e4b3348285607631630e6dda415a9e29e967d (diff)
downloadtrackermap-web-fb330f777ceb0e531699ea0842c0199622114288.tar.gz
trackermap-web-fb330f777ceb0e531699ea0842c0199622114288.tar.bz2
trackermap-web-fb330f777ceb0e531699ea0842c0199622114288.zip
Optimize image loading
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/map/Map.js6
1 files 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);
};