如何使用BING MAPS中的标题旋转图钉?

时间:2016-01-11 10:37:20

标签: javascript bing-maps

我想根据Bing Map上的标题旋转我的pushPin(标记)。 代码是:

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);

我可以在地图上绘制标记,但我无法旋转标记。请任何一个帮助。三江源。

1 个答案:

答案 0 :(得分:0)

如果您定位支持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属性中进行更改,并将锚点更改为中心或公共图标。

另见Cross browser way to rotate image using CSS?