簡體   English   中英

如何使用BING MAPS中的標題旋轉圖釘?

[英]How to rotate pushpin using heading in BING MAPS?

我想根據Bing地圖上的標題旋轉pushPin(marker)。 代碼是:

var location = new Microsoft.Maps.Location(data[index].latitude, data[index].longitude);
    var pushpinOptions = {
        icon: "/images/carMarker.png",
        width: 50,
        height: 50,
        anchor: new Microsoft.Maps.Point(10, 40),
        typeName: 'carMarker'
    };
    map.entities.remove(carPin);
    carPin = new Microsoft.Maps.Pushpin(location, pushpinOptions);
    map.entities.push(carPin);

我可以在地圖上繪制標記,但是無法旋轉標記。 請任何一個幫助。 謝謝。

如果要針對支持CSS3的瀏覽器,則可以使用transform屬性,請參閱: http : //www.w3schools.com/cssref/css3_pr_transform.asp

.carMarker {
    -ms-transform: rotate(45deg); /* IE 9 */
    -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
    transform: rotate(45deg);
}

如果不這樣做,則必須生成N版本的圖標,並在icon屬性中對其進行更改,並將錨點更改為位於中心或常用圖標中。

另請參閱跨瀏覽器使用CSS旋轉圖像的方法?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM