我正在开发一个谷歌地图实现,在我的情况下,我不想通过放大和缩小来缩放我的自定义标记。有谁知道如何解决这个问题?我希望它们保持与我给它们相同的宽度和高度。
这里是代码:
function Icon(url) {
this.url = url;
this.scaledSize = new google.maps.Size(30, 30); // scaled size
this.origin = new google.maps.Point(0,0); // origin
this.anchor = new google.maps.Point(0, 0); // anchor
}
var icon1 = new Icon('img/marker-1.png');
var icon2 = new Icon('img/marker-2.png');
var icon3 = new Icon('img/marker-3.png');
var icon4 = new Icon('img/marker-4.png');
var icon5 = new Icon('img/marker-5.png');
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][0].lat, locations[i][0].lng),
icon: icon1,
//size: new google.maps.Size(100,100),
map: map
});