remove retry on resizeMarkers, as it caused move events to become mangled

This commit is contained in:
Iris Lightshard 2023-07-15 19:41:57 -06:00
parent e34ab4711c
commit d2c431760f
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -24,11 +24,11 @@ function initializeMap(mapImgUrl) {
// this works but assumes the map is square (reasonable limitation I think)
function resizeMarkers() {
let tryAgain = false;
// for newly created tokens, the icon may not be loaded and thus the resize will not properly complete
// we need a way to queue the resize for when the icon is finished loading
tokens.forEach(t=>{
if (t.m._icon == null) {
tryAgain = true;
} else {
const icon = t.m.options.icon;
const scaleFactor = mapImg._image.clientWidth / mapImg._image.naturalWidth;
@ -39,9 +39,7 @@ function resizeMarkers() {
t.m.setIcon(icon);
}
});
if (tryAgain) {
setTimeout(resizeMarkers, 500)
}
}
function processTokens(tokenChanges) {