I am using for a Google Maps Marker (V3) the icon in the following way:
var marker = new google.maps.Marker({
id: "theId",
icon: {
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
strokeColor: "green"
},
map: map,
title: "theTitle",
position: someLatitudeLongitude
});
Now after creating this marker I like to change the color run-time with a color panel. Now this works perfectly for a polyline or polygon, but for the marker not quite well: it is changed but not real-time updated.
Code:
selectedShape.icon.strokeColor = color;
PROBLEM: Does not show color change on map. Only after saving and reloading the map, the correct color is shown.
For a polygon I use:
selectedShape.set('strokeColor', color);
This works fine.
So is there a set like operator for the marker or a partial refresh?
Thanks for any help.
Best regards,
Evert Wiesenekker
I would bind on an event where the color changes, then call marker.setIcon(icon_options)
on the marker to pass in the new values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With