mirror of
https://0xacab.org/sutty/sutty
synced 2025-01-19 23:13:38 +00:00
obtener el overlay antes que nada
This commit is contained in:
parent
a664c2dcd3
commit
c77fb50366
1 changed files with 3 additions and 3 deletions
|
@ -14,15 +14,15 @@ export default class extends Controller {
|
||||||
static targets = [ 'lat', 'lng', 'map', 'overlay' ]
|
static targets = [ 'lat', 'lng', 'map', 'overlay' ]
|
||||||
|
|
||||||
async connect () {
|
async connect () {
|
||||||
|
const res = await fetch(this.element.dataset.map);
|
||||||
|
this.overlayTarget.innerHTML = await res.text();
|
||||||
|
|
||||||
this.marker()
|
this.marker()
|
||||||
|
|
||||||
this.latTarget.addEventListener('change', event => this.marker())
|
this.latTarget.addEventListener('change', event => this.marker())
|
||||||
this.lngTarget.addEventListener('change', event => this.marker())
|
this.lngTarget.addEventListener('change', event => this.marker())
|
||||||
window.addEventListener('resize', event => this.map.invalidateSize())
|
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.map.on('click', event => {
|
||||||
this.latTarget.value = event.latlng.lat
|
this.latTarget.value = event.latlng.lat
|
||||||
this.lngTarget.value = event.latlng.lng
|
this.lngTarget.value = event.latlng.lng
|
||||||
|
|
Loading…
Reference in a new issue