[英]change custom marker shape google maps api
我正在使用Google地图显示用户位置的应用程序,每个用户都是他的图片在页面上的标记。
用户图片的形状为正方形,我想将其更改为圆形而不更改其原始形状。
有谁知道是否有可能通过谷歌地图API?
创建标记的代码如下:
let userLatLng = {lat: coordinates[0], lng: coordinates[1]};
let icon = {
url: Config.s3Address + profileImg,
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(0, 0),
scaledSize: new google.maps.Size(50, 50)
};
let shape = {
coords: [0, 0, 60],
type: 'circle'
};
let marker = new google.maps.Marker({
map: this.map,
clickable: true,
animation: google.maps.Animation.DROP,
position: userLatLng,
icon: icon,
shape: shape
});
let content = "<h4>" + userName + "</h4>";
this.addInfoWindow(marker, content);
感谢所有的帮手! :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.