diff --git a/loko/authorizations/templates/authorizations/new_authorization_default.html b/loko/authorizations/templates/authorizations/new_authorization_default.html index bc9780a..ead91da 100644 --- a/loko/authorizations/templates/authorizations/new_authorization_default.html +++ b/loko/authorizations/templates/authorizations/new_authorization_default.html @@ -487,25 +487,28 @@ const isFirst = markers.length === 0; const el = document.createElement('div'); + const dot = document.createElement('div'); + el.appendChild(dot); + if (isFirst) { - el.className = 'poly-marker poly-marker-first'; - el.style.cssText = 'width:14px;height:14px;border-radius:50%;background:#198754;border:2px solid #fff;box-shadow:0 0 4px rgba(0,0,0,.5);cursor:pointer;transition:transform 0.15s;'; - el.title = '{% translate "Cliquer pour fermer le polygone" %}'; - el.addEventListener('mouseenter', function () { - if (vertices.length >= 3) el.style.transform = 'scale(1.3)'; + dot.className = 'poly-marker poly-marker-first'; + dot.style.cssText = 'width:14px;height:14px;border-radius:50%;background:#198754;border:2px solid #fff;box-shadow:0 0 4px rgba(0,0,0,.5);cursor:pointer;transition:transform 0.15s;'; + dot.title = '{% translate "Cliquer pour fermer le polygone" %}'; + dot.addEventListener('mouseenter', function () { + if (vertices.length >= 3) dot.style.transform = 'scale(1.3)'; }); - el.addEventListener('mouseleave', function () { - el.style.transform = 'scale(1)'; + dot.addEventListener('mouseleave', function () { + dot.style.transform = 'scale(1)'; }); - el.addEventListener('click', function (ev) { + dot.addEventListener('click', function (ev) { ev.stopPropagation(); if (vertices.length >= 3) { finishPolygon(); } }); } else { - el.className = 'poly-marker'; - el.style.cssText = 'width:10px;height:10px;border-radius:50%;background:#0d6efd;border:2px solid #fff;box-shadow:0 0 3px rgba(0,0,0,.4);cursor:default;'; + dot.className = 'poly-marker'; + dot.style.cssText = 'width:10px;height:10px;border-radius:50%;background:#0d6efd;border:2px solid #fff;box-shadow:0 0 3px rgba(0,0,0,.4);cursor:default;'; } const marker = new maplibregl.Marker({ element: el }).setLngLat([lng, lat]).addTo(map);