all repos — felt @ d2c431760fe627803f742d25398f190ec0d7fb32

virtual tabletop for dungeons and dragons (and similar) using Go, MongoDB, and websockets

remove retry on resizeMarkers, as it caused move events to become mangled
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmSzSuUACgkQO3+8IhRO
Y5irLw//ZRWb4XU9OFtEYzR0ni5J1HEpjMTyNzU1nWje/ha7S0OsbbXNFUMl2Hxn
p/Dbm3ar85kakMgcGNxX7WTSiYdCh09dZWtDkfw1rBR1yEVPBd7YKlSNGUiGPGAH
vJO1xSvg/p43enfivPvo0NEplWcjrbfr+3dWaCMw1fjUIz+VKL9IXayL8xW0auxr
A/DzMP4t/UiPnb0AQpD7/6O7nj0i0MupVyRsMaVBavSinihNeyIOU1ZSr3CW18ue
J4tmJLK7Y/qvBtimG7oF1aJFVHahjMRaCWlI+lmFe2iT4SkalWpKhbf26IirLPVC
tCI/hnCGYW86ksVVlnv5wRndH2MEdYp82GRYQ7vbzdfZaUGn50nNruQ0PCru06Qc
9ZeCz/YXWmztCvNOoI16ERrMxZmQHUzn7eu84/hkAnfvwcG12hZDyc2GD5Xu6eG+
uBqQuzxC8naq675xqagvUXzghov+p1PkBAtGQrnSEHwEgGK/vcZAvT/vVxKSj46y
h+YRxzjwafoloKbtmrd3MHpS3sbDwTfK8NS5PNNnhKvEKirmhHUAstYooLx4WF3f
lBFfBF9jx1BP1Pns3EGa/oi5783vUSVMI+X9HD5KtBLGzg0wnPUHwK1qW86YbQzr
EaEOFCRmww4wlj00I7BWRLsnCt2D+UY8fn+LZ7mtLprxfk8fgas=
=C0qu
-----END PGP SIGNATURE-----
commit

d2c431760fe627803f742d25398f190ec0d7fb32

parent

e34ab4711cc9be60fa9949ddabd0b129883b7d5b

1 files changed, 5 insertions(+), 7 deletions(-)

jump to
M static/map.jsstatic/map.js

@@ -24,11 +24,11 @@ }

// 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 @@

t.m.setIcon(icon); } }); - if (tryAgain) { - setTimeout(resizeMarkers, 500) - } + } function processTokens(tokenChanges) {