I want to dynamically update the “origin” point of a sprite generated by the MarkerImage constructor in Google Maps API v3, and am wondering if that’s possible without generating a new MarkerImage entirely.
Here’s some code:
// Marker options
var markerOptions = {
icon: new google.maps.MarkerImage('../images/content/marker.png',
new google.maps.Size(88,88),
new google.maps.Point(0,0),
new google.maps.Point(44,88)
),
position: position,
map: map
}
var marker = new google.maps.Marker(markerOptions);
Can I do something along the lines of marker.setPoint(0,10) or do I need to create a new MarkerImage just to set the sprite origin again?
There is no way (at least according to the API reference) to alter the properties of a MarkerImage after it has been created. You can create a new MarkerImage and call
marker.setIcon().