浏览器地理定位回调的频率是多少?

时间:2012-12-01 20:15:01

标签: ruby-on-rails google-maps geolocation haml gmaps4rails

我从gmaps4rails获得以下代码,并且它不断地使地图在移动浏览器中闪烁。我很想知道Gmaps.map.geolocationSuccess回调频繁发生的频率。地图是否在移动浏览器中闪烁,因为它经常刷新此回调?

- content_for :scripts do
  :javascript
    Gmaps.map.geolocationSuccess = function(){
      var lng = Gmaps.map.userLocation.lng();
      var lat = Gmaps.map.userLocation.lat();
      //load map then add the markers
      $('.map_container').hide();
      $('.map_container').show();
      Gmaps.loadMaps();

      //add markers from controller
      Gmaps.map.addMarkers(#{@maps_json});

      var user_image = "http://wiki.alumni.net/wiki/images/thumb/5/55/Wikimap-blue-dot.png/50px-Wikimap-blue-dot.png";

      //add current location marker
      Gmaps.map.addMarkers([{
        "lng": lng,
        "lat": lat,
        "width":"40",
        "height":"48",
        "picture": user_image
      }]);

      //center the screen on your current location
      Gmaps.map.serviceObject.setCenter(new google.maps.LatLng(lat, lng));
      Gmaps.map.serviceObject.setZoom(14);
    };

0 个答案:

没有答案