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
Post a Comment