map.getCenter.lng() extends beyond -180 when dragging continuously. How can I stop that? -


heres code:

google.maps.event.addlistener(map, 'idle', function(e) {     console.log(map.getcenter().lng();       }); 

when dragging map horizontally repeatedly produce pattern such as: 0, -60, -120, -180, -240, -300

but hoping for: 0, -60, -120, -180, 120, 60

is bug in gmaps or not?

thanks!

some bug, while others feature. fair seem "correct" behaviour, doesn't give usable results.

i believe common way of getting past "feature" make sure value never below -180 og above 180. easy way accomplish make call:

map.getcenter().lng() % 180; 

this give modulus 180 remainder when have subtracted 180 until value in correct range.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -