У меня есть карта Google с несколькими различными типами значков. У меня есть тень на каждой иконке. Как я могу отрегулировать смещение тени маркера от маркера?
В цикле, который строит каждый маркер, у меня есть:
var icon = customIcons[type];
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
shadow: icon.shadow
});
Значок устанавливается по типу.
var customIcons = {
Football: {
icon: 'http://path-to-image1.png',
shadow: 'http://path-to-shadow-image1.png'
},
Lacrosse: {
icon: 'http://path-to-image2.png',
shadow: 'http://path-to-shadow-image2.png'
}
};
В этом руководстве они устанавливают размер и смещение для одного значка следующим образом:
var image = new google.maps.MarkerImage('images/beachflag.png',
// This marker is 20 pixels wide by 32 pixels tall.
new google.maps.Size(20, 32),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(0, 32));
var shadow = new google.maps.MarkerImage('images/beachflag_shadow.png',
// The shadow image is larger in the horizontal dimension
// while the position and offset are the same as for the main image.
new google.maps.Size(37, 32),
new google.maps.Point(0,0),
new google.maps.Point(0, 32));
В моей ситуации у меня есть несколько значков, и они установлены в объекте. Как я могу добавить размер и смещение к var customIcons
?
Спасибо.