remove retry on resizeMarkers, as it caused move events to become mangled
This commit is contained in:
parent
e34ab4711c
commit
d2c431760f
1 changed files with 5 additions and 7 deletions
|
@ -24,11 +24,11 @@ function initializeMap(mapImgUrl) {
|
||||||
|
|
||||||
// this works but assumes the map is square (reasonable limitation I think)
|
// this works but assumes the map is square (reasonable limitation I think)
|
||||||
function resizeMarkers() {
|
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=>{
|
tokens.forEach(t=>{
|
||||||
if (t.m._icon == null) {
|
|
||||||
tryAgain = true;
|
|
||||||
} else {
|
|
||||||
const icon = t.m.options.icon;
|
const icon = t.m.options.icon;
|
||||||
const scaleFactor = mapImg._image.clientWidth / mapImg._image.naturalWidth;
|
const scaleFactor = mapImg._image.clientWidth / mapImg._image.naturalWidth;
|
||||||
|
|
||||||
|
@ -39,9 +39,7 @@ function resizeMarkers() {
|
||||||
t.m.setIcon(icon);
|
t.m.setIcon(icon);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (tryAgain) {
|
|
||||||
setTimeout(resizeMarkers, 500)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processTokens(tokenChanges) {
|
function processTokens(tokenChanges) {
|
||||||
|
|
Loading…
Reference in a new issue