sosbrumadinho / brumadinho_location

Conjunto de ferramentas para ajudar no resgate e localização das vítimas atingidas pelo rompimento da barragem que ocorreu recentemente em Brumadinho/MG
MIT License
868 stars 129 forks source link

Get location by click on map #59

Closed luanssouza closed 5 years ago

luanssouza commented 5 years ago

When the user clicks on the map, the input fields must be filled with the location data

filipesiegrist commented 5 years ago

I am trying to do this, but I'm having some scopes problems. In theory it's easy, just add an dblclick event, but the javascript code initializes the map in a function and the page doesn't recognizes the event:

This is what I'm trying to do:

`window.ma.on('dblclick',function(e){

lat = e.latlng.lat;

lon = e.latlng.lng;

document.getElementById("lat").value = lat;

document.getElementById("lng").value = lon;

calculate();

});`

Sorry, I'm new here and I'm unable to post a decent code quote above.

Mendes11 commented 5 years ago

There is already a PR regarding this issue. Although it's to the develop branch, which is outdated #55

luanssouza commented 5 years ago

Yes. I will try to make a PR with the changes to the master branch.