start markpoints without add on map (turn off default)

This commit is contained in:
Luiz Costa 2024-06-06 12:17:26 +01:00
parent 6d533c91b4
commit 31c43a6914

View File

@ -44,7 +44,7 @@ function init_map(frm) {
currentMap = map;
// Create a layer group for checkpoint markers
var checkpointMarkers = window.L.layerGroup().addTo(map);
var checkpointMarkers = window.L.layerGroup();
// Control to toggle checkpoint markers
var control = window.L.control({ position: 'topleft' });
@ -55,12 +55,12 @@ function init_map(frm) {
button.href = '#';
window.L.DomEvent.on(button, 'click', function (e) {
window.L.DomEvent.stop(e); // Alterado para parar totalmente o evento
window.L.DomEvent.stop(e);
if (map.hasLayer(checkpointMarkers)) {
map.removeLayer(checkpointMarkers); // Desligar
map.removeLayer(checkpointMarkers); // turn off
} else {
map.addLayer(checkpointMarkers); // Ligar
map.addLayer(checkpointMarkers); // turn on
}
});