From a219a62fca55a4f578162d2ecd4884c9ff12131d Mon Sep 17 00:00:00 2001 From: RekHoto Date: Tue, 21 Nov 2023 19:22:22 +0400 Subject: [PATCH] images fix --- src/Map/MapComponent.jsx | 2 ++ src/utils.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Map/MapComponent.jsx b/src/Map/MapComponent.jsx index b1a1158..57f055d 100644 --- a/src/Map/MapComponent.jsx +++ b/src/Map/MapComponent.jsx @@ -195,6 +195,8 @@ export const MapComponent = () => { icon.size?.width || 64, icon.size?.height || 64 ); + img.src = icon.url; + img.crossOrigin = "Anonymous"; img.onload = () => mapRef.current.addImage(icon.name, img); img.src = icon.url; diff --git a/src/utils.js b/src/utils.js index 9170ef9..39461ac 100644 --- a/src/utils.js +++ b/src/utils.js @@ -17,6 +17,7 @@ var chars = {"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N"," export function transliterate(word){ return word.split('').map(function (char) { + if (char === " ") return ''; return chars[char] || char; }).join(""); }