我在用gmap和angularjs。我为标记创建了一个json数组变量,其中包括id和coords,如下所示:

{ "id": 1, "coords": { "latitude": 20 , "longitude": 30 } ,"icon": {"url": 'image.gif'}},

但问题是gif标记图标不循环。我也试过放置optimized : false,但没有改变。当我打开panaroma视图时,gif会循环,但在普通地图上不会循环。你能帮我怎么做吗?或任何例子。

最佳答案

因为您已经设置了optimized: false,所以您可以在thread中尝试代码示例。

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Google Maps JavaScript API v3 Example: Marker Simple</title>
    <link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
    <script src="http://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
    <script>
      function initialize() {
        var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
        var mapOptions = {
          zoom: 4,
          center: myLatlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);

        var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            title: 'Hello World!',
            icon: "http://gwtportlets.googlecode.com/svn-history/r46/trunk/src/org/gwtportlets/portlet/public/img/portlet-loading-32x32.gif",
          optimized: false
        });
      }
    </script>
  </head>
  <body onload="initialize()">
    <div id="map_canvas">

    </div>
   </body>
</html>

您还可以检查这个相关的SO question声明标记使用称为优化呈现的东西,它总是将标记呈现为静态的。检查生成标记的示例代码:
var marker = new google.maps.Marker({
    position: latLng,
    map: map,
    icon: icon,
    optimized: false
  });

希望这有帮助!

关于java - Gmap Angularjs Gif标记不会循环,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38974851/

10-12 00:06
查看更多