Scaling in google map api 3 [ios]

According to Google Map Documentation . In iphone

Zooming in with two fingers.

So, when I touch my fingers on the screen and move around, then zoom in on the map, but after that, when I unlock my fingers from the screen, then zoom in, which I see before reloading the map, much more than the actual scale that is displayed.

I am currently testing that on an iPhone 5 with ios 7.1.2 and an iPhone 4S with ios 8 >

I use the jQuery Mobile Framework in my application, and the map is created dynamically. (when I create a map with fixed values, then it works fine)

I created a fiddle in which you can see the same problem. Link

Some picture of my problem. The first image map opens.

first

The second image when I try to enlarge the map with my finger.

second picture

The third image when I released my finger from the screen.

third picture

Thus, it cannot support the zoom level that is displayed in the second image. How to solve this problem

+5
source share
2 answers

Try replacing:

 google.maps.event.addListener(mapClass.map, 'zoom_changed', function() { mapClass.map.panTo(myLatlng); }); 

from:

 google.maps.event.addListener(mapClass.map, 'zoom_changed', function() { mapClass.map.panTo(mapClass.map.center); }); 

Hope this helps.

+1
source

I solved this problem (or perhaps very similar) to buy throttling work that I did in the zoom_changed . I used lodash throttle .

Replace it

 google.maps.event.addListener(mapClass.map, 'zoom_changed', myFunction); 

With the help of this

 google.maps.event.addListener(mapClass.map, 'zoom_changed', _.throttle(myFunction,100)); 
0
source

Source: https://habr.com/ru/post/1203472/


All Articles