2013-02-15 156 views
2

我有下面的代碼標記添加到我的地圖前彈出。有其他人遇到過這個問題嗎?自定義標記圖標動畫

+0

如果在定義標記時排除地圖參數,然後設置地圖,會發生什麼情況?換句話說,設置標記映射參數的延遲是否解決了問題? – 2013-05-02 16:02:21

+0

您使用的是哪種谷歌地圖版本?根據更新日誌,這個問題已在v3.7中得到修復(我已經在自己之前觀察過了,但在3.7版本之前很久以前)。原始錯誤說明 - https://code.google.com/p/gmaps-api-issues/issues/detail?id=3608變更日誌 - https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog – Adam 2013-05-02 16:40:23

回答

3

我遇到了這種相同的行爲,我發現進一步定義自定義圖標有助於解決此問題。

var image = { 
    url: 'images/map_marker.png', 
    // This marker is 20 pixels wide by 30 pixels tall. 
    size: new google.maps.Size(20, 30), 
    // The origin for this image is 0,0. 
    origin: new google.maps.Point(0,0), 
    // The anchor for this image is the base of the image at 0,30. 
    anchor: new google.maps.Point(10, 30) 
}; 

var marker = new google.maps.Marker({ 
    icon: image, 
    map: map, 
    position: latlng, 
    draggable: false, 
    title: trip_name, 
    animation: google.maps.Animation.DROP 
});