Javascript 在Google Maps API V3中复制图标
我用V2 API编写了以下代码:Javascript 在Google Maps API V3中复制图标,javascript,google-maps,Javascript,Google Maps,我用V2 API编写了以下代码: // replicate a different sized icon var babyIcon = new google.maps.Icon(marker.getIcon()); babyIcon.iconSize = new google.maps.Size( marker.getIcon().iconSize.width * this.iconScale_, marker.getIcon().iconSiz
// replicate a different sized icon
var babyIcon = new google.maps.Icon(marker.getIcon());
babyIcon.iconSize = new google.maps.Size(
marker.getIcon().iconSize.width * this.iconScale_,
marker.getIcon().iconSize.height * this.iconScale_
);
babyIcon.iconAnchor = new google.maps.Point (
marker.getIcon().iconAnchor.x * this.iconScale_,
marker.getIcon().iconAnchor.y * this.iconScale_ / 2
);
但是,我无法将其转换为v3,因为我知道v3 API没有图标构造函数。有什么想法吗?您想使用标记图像而不是图标(getIcon()将返回标记图像) 这是你的电话号码
var babyIcon = new google.maps.MarkerImage(marker.getIcon());
babyIcon.size = new google.maps.Size(
marker.getIcon().size.width * this.iconScale_,
marker.getIcon().size.height * this.iconScale_
);
babyIcon.anchor= new google.maps.Point (
marker.getIcon().anchor.x * this.iconScale_,
marker.getIcon().anchor.y * this.iconScale_ / 2
);