5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 15:41:42 +00:00

obtener el overlay antes que nada

This commit is contained in:
f 2022-02-01 17:38:29 -03:00
parent a664c2dcd3
commit c77fb50366

View file

@ -14,15 +14,15 @@ export default class extends Controller {
static targets = [ 'lat', 'lng', 'map', 'overlay' ]
async connect () {
const res = await fetch(this.element.dataset.map);
this.overlayTarget.innerHTML = await res.text();
this.marker()
this.latTarget.addEventListener('change', event => this.marker())
this.lngTarget.addEventListener('change', event => this.marker())
window.addEventListener('resize', event => this.map.invalidateSize())
const res = await fetch(this.element.dataset.map);
this.overlayTarget.innerHTML = await res.text();
this.map.on('click', event => {
this.latTarget.value = event.latlng.lat
this.lngTarget.value = event.latlng.lng