[英]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.