我为某个位置创建了一个标记,但问题是,标记一直阻碍位置名称我希望标记位于位置名称下方而不更改当前缩放级别。是否有任何选项可以添加到构造
var marker = new google.maps.Marker({
//options
});
Thnx
答案 0 :(得分:0)
一种选择可能是缩小标记图像的大小。 示例代码:
var image = {
url: 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png',
// This marker is 20 pixels wide by 32 pixels high.
size: new google.maps.Size(20, 32),
// The origin for this image is (0, 0).
origin: new google.maps.Point(0, 0),
// The anchor for this image is the base of the flagpole at (0, 32).
anchor: new google.maps.Point(0, 32)
};
var marker = new google.maps.Marker({
position: {lat: 25.2523934, lng: 55.3336367},
map: map,
icon: image
});
}