简体   繁体   中英

Google map on phonegap project

I am finishing an app for iphone/android in which I display a map (google maps) with my position and a lot of pins nearby.

My problem is that the first time it works perfect and the second time I open it, it centers it wrong and it only shows a part of the map, the top left part and only like the first quarter of the map is visible. Did someone have this issue? Thanks for your help

Can you provide some code. I've faced same when i tried to reuse the division with data role try creating new request each time you wish to see map

For me, the following worked:

After creating the 'map' object, do:

google.maps.event.addListenerOnce(map, 'idle', function() {
       google.maps.event.trigger(map, 'resize');
       map.setCenter(mapCenter);
    });

This is not my solution. I found it somewhere here on SO, but I just can't seem to find the same post again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM