以下是旋转标记的代码,但是如何旋转自定义标记.任何的想法?
var angleDegrees = 150;
new google.maps.Marker({
position: a,
map: map,
icon: {
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
scale: 6,
fillColor: "red",
fillOpacity: 0.8,
strokeWeight: 2,
rotation: angleDegrees //this is how to rotate the pointer
}
});
Run Code Online (Sandbox Code Playgroud)
小智 23
在API中可以使用旋转. https://developers.google.com/maps/documentation/javascript/examples/overlay-symbol-custom
var icon = {
...
path: '...',
scale: 1,
rotation: [degrees]
};
marker = new google.maps.Marker({
map: [...],
icon: icon,
...
});
Run Code Online (Sandbox Code Playgroud)
API参考没有具体说明如何完成旋转,但由于path采用 SVG 元素,我想说这就是他们设法旋转它的方式。如果您使用 SVG 创建自定义标记,则可以使用transform="rotate(deg centerX centerY").
| 归档时间: |
|
| 查看次数: |
44013 次 |
| 最近记录: |