jawj / OverlappingMarkerSpiderfier

Deals with overlapping markers in Google Maps JS API v3, Google Earth-style
http://blog.mackerron.com
836 stars 238 forks source link

Animation #87

Open viskin opened 9 years ago

viskin commented 9 years ago

Hi George.

This PR adds possibility to use marker-animate-unobtrusive to perform marker animations. The process is explained here. It includes non-functional and functional changes.

Non-functional changes are:

Functional changes are calls to ghostPosition instead of position everywhere.

What marker-animate-unobtrusive provide is MarkerWithGhost class that one can use instead of google.maps.Marker. It makes marker animate between setPosition calls, and in addition it provides "ghost mode", in which marker moves without notifying its position changes to user code. You enter "ghost mode" by calling setGhostPosition, and position changes are traced with ghostposition_changed events. It makes spiderfying completely transparent to user code.

My knowledge of coffeescript is close to zero, so I hope you can fix changes I made in oms.coffee.

What I did not implement is, of course, feature detection. It should check for existence of setGhostPosition method on marker, and if not found, call plain setPosition, as usual. Same with ghostposition_changed event and ghostPosition field.

Hope you will find this functionality useful.

viskin commented 9 years ago

Just an afterthought.

It would be nice to receive (optionally) alternative getPosition and setPosition functions for marker, as well as name of 'position_changed' event. This way without affecting original implementation, it will be possible for marker-animate-unobtrusive to use the original version Spiderfier by providing these alternative implementations.

I just don't know coffeescript, otherwise I'd provide a PR for this.