-1
지도 마커 세트가있는 Google지도가 있습니다. 필자는 기본 이미지 대신 pinSymbol()이라는 함수를 사용하여지도 표시자를 그리기로했습니다.클릭시 어떻게 Google지도 아이콘을 다시 그릴 수 있습니까?
클릭 할 때 핀의 색상을 변경하고 싶지만 업데이트 할 수 없습니다. 아이콘의 속성을 변경할 수있는 현재 코드에서는 console.log (마커)로 볼 수 있지만 맵의 색상은 업데이트되지 않습니다.
질문 : 어떻게하면 아이콘을 다시 그릴 수 있습니까?
이것은 내 코드입니다.
// Open infowindow when marker is clicked and change color
restaurant.marker.addListener('click', function(){
this.icon = pinSymbol('#EED4D9', '#EED4D9');
console.log(restaurant.marker);
infowindow.open(map, this);
});
}
pinSymbol 기능을
// Create pin for google map marker
function pinSymbol(color, strokeColor) {
return {
path: 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z',
fillColor: color,
fillOpacity: 1,
strokeColor: strokeColor,
strokeWeight: 1,
scale: 1,
labelOrigin: new google.maps.Point(0,-29)
};
}