Anyone who used map.center.lat() in ionic?

It works different from browser…on mobile device.

from point A, I drag map and go until point B is at the center of map.
then I mouse up, at that point I get lat and leg of map’s center which is B’s position.

code is as below.


 google.maps.event.addListener(map,'mouseup',(event)=>{
       alert(mouseup)
        alert(map.center.lat()+"!"+map.center.lng());
        console.log("mouseup????????????"+event.latLng.lat()+","+event.latLng.lng());

On browser It works perfect. it get lat and lng when Mouse is up (B position)
but the problem is that on mobile device.
it get A point’s lat and lng
I alert mouseup to see mouseup is triggered differently , but It works fine on mobile device.
why is it getting map center position wrong?

dragend + getCenter() works on both browser and device :frowning: weird

google.maps.event.addListener(map,'dragend',(event)=>{
            
            let request = {
                latLng: {lat:map.getCenter().lat(),lng:map.getCenter().lng()}
              };
1 Like