From 1297a9eeab313a55507a1925488376d3f612b48a Mon Sep 17 00:00:00 2001 From: Sylvain Gay Date: Mon, 12 Sep 2022 09:40:47 +0200 Subject: [PATCH] added invisiblity support --- invi.png | Bin 0 -> 6215 bytes map.html | 38 ++++++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 invi.png diff --git a/invi.png b/invi.png new file mode 100644 index 0000000000000000000000000000000000000000..ee966424efa1861ee52f5b23db8084269e3f0488 GIT binary patch literal 6215 zcmeHKc{G&m`yX#_h)~)@GEKEvk_9+3Y$+BUUY=P`J{xF$!v_fqNeqft|z8q5cy z7Tq0s5MQC){qbSeg9!3p8h$0_;*8C0Z?3A^PkJUlDsA*kj;&pn?%sIx(W$(#H@?^X zebskHZaZ;k3iZsy4>TD&#mK4YGm z#*4YXHV!Qs&Pmpjx~Ai5Wjk56G^_On$*U(@ukdzX(elXg#g8(!RX;A9>T$TEw}J+E zh3cpmJI{aLAk}$Qc4}@>CTz58^jK|igoQDnh`|(Yc)Z}z>$D3@Wn`aU;FC*PVP11! zhz*=Fm8F>M6|vyHB|Az?4I<{lb%1`)xVt_PC2dP$@7rGAy+SPW>V`pzvS#wX*EvJv*=z@Z>Mb2tysgSp}jRqFHSgF?3qWr z&}}7)%`G?q|Ld{ry7*N$(v`KTDx{wNC`DZ`Q!69jY@^w}6}tIqPCNs z5b^BFHMMt`9j(W3c9GQ?ccxzq8@3NT)Vj?K5Y$N(DT_5mDwBlvjGfaH_DTxrx#P{2 z)_#$7l`-;o8I{QCf|suxlu%QpCCZVEmCGJ>6KtL+q=fFLW<1Tg7r2_%wY496=+#cY zs`U-+%(b5Y9d3lc8?dSm9y+Bv#Yzd%{deT{icT7*XYgrA?H_lxx<;9}yxyO<+8$@$ zXB+eOX|-MK?acKr4`&wEh`S=(|L~}D%v1~6!)&`GJ1}4`G9Iy`yz@Ay)31I~)>W)p z&QM5~=~#2>oYKZn4)toxFxEk^*}T|!&w`@PGjsIn?P_+Di7oO6F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`Kp)#-SiiVtBP?(1NS!bv@ z6tkfwkVf4=X7D&DfXSnSC^3f*HHk2o$vQC~VEBVVI34t5b4?MW7q1}TY^Eu~gFwYl z`BtDG+dec1bPaWMV}$xMNKC{!GdUA683N#dLI5u21aJjpu_AU@DyfRDzaFlY`3{iBCKXcGc~d1?=w&ewJ0BAYc9KaVu^SQn=3JKw43ulTc0*AtUmpBIiLKfs;irB#B z28+Kd+}Iq@RR~Df#1e@(BMbp&U}QuvFu>uz8@Yo)0;m!tm{<(T05_wNEDIS*1|k-a z)F}ioBZqP!TLpoDkQd~};{})^Bq6~ip5N3|Xge_hAz%#%K?oFs!;vv0G8W^8#gTCs zvVoyK29o?>&ttM#JN_?g$>xEZ%r3b-TL8_!V@5Q)qg=tj*|*u(0QSsQg2QJv1sPz> zrXT=9K;}%G5Z0`U;RkSiLFn}OQm$X+?Eg>-1iB#>3t#{wkz@cO@dPGRS9ClRX=p@X zFj-hUfxwt0?;E;+#}bNwAke}W;t}EsD$g0N;5su4rTcR%B0o^F3J_sP3<>$2FrzPo zp}!=ImYf-1Gd4m0FHTHm41PFdAir4|ba+8$A^O{4_=Phl-v8$3%Ub+5r+~wMPx4Fr z{-*0UUBAS@FB$)?uHSV15(B?v{JXmT-{_M2ew_ljP!}YEE=%2?0}G&wmNebL&KmYv z^3ATvPlY7&`1YFxFc@mJLQxh@0}$_Ob`8<|)0A9I#*gG9@PHZ-9Xk0a^I zVKdDl$b^g7LO-~qS@hVgxC}DVrdV6JskAbD%;#8qUj9jD+V^cD>h5)O&FssTwgDqK fH?5;rb^F7*mE^PAPef-x9x#fHqjjmJ&z}DQQFPhI literal 0 HcmV?d00001 diff --git a/map.html b/map.html index b2dd1df..1f57b8a 100644 --- a/map.html +++ b/map.html @@ -59,7 +59,16 @@ }) ]; var self_icons = icons; - var self_invisible_icon = icons[1]; + var self_invisible = + L.icon({ + iconUrl: 'invi.png', + iconSize: [10, 10], + iconAnchor: [5, 5], + popupAnchor: [5, 5], + //shadowUrl: 'my-icon-shadow.png', + //shadowSize: [68, 95], + //shadowAnchor: [22, 94] + }); ////////////////////////////////////////////////////////////////////////////// // INIT MAP @@ -95,18 +104,19 @@ if(data.id in colors && colors[data.id] == -1 && data.id in markers) markers[data.id].addTo(map); colors[data.id] = data.color; - if(data.color == -1){ - if(data.id in markers){ - if(data.id == id) - markers[data.id].setIcon(self_invisible_icon); - else - markers[data.id].remove(); - } - } else if(data.id in markers){ - if(data.id == id) - markers[data.id].setIcon(self_icons[data.color]); + if(data.id in markers){ + if(data.id == id) + if(data.color == -1) + markers[data.id].setIcon(self_invisible); + else + markers[data.id].setIcon(self_icons[data.color]); else - markers[data.id].setIcon(icons[data.color]); + if(data.color == -1) + markers[data.id].setOpacity(0); + else{ + markers[data.id].setOpacity(1); + markers[data.id].setIcon(icons[data.color]); + } } }); @@ -121,8 +131,8 @@ else icon = icons[colors[data.id]]; markers[data.id] = L.marker(data.position, {"icon": icon}).addTo(map); - if(colors[data.id] == -1) - markers[data.id].remove(); + if(data.id == id) + markers[data.id].setZIndexOffset(10000); if(data.id in names) markers[data.id].bindPopup(names[data.id]); } else{