Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 2.18 KB

MIGRATING.md

File metadata and controls

26 lines (19 loc) · 2.18 KB

Migrating to 2.0.0

What to do

Across the board the directives now use google.maps.LatLngLiteral objects to represent latitude/longitude points. Many directives were implicitly already using this format, e.g. gm-position on gm-markers, so in those cases only the wording in the documentation has changed. The only true breaking change is with gm-map:

gm-map

  • gm-center now evaluates to a google.maps.LatLngLiteral instead of a google.maps.LatLng

Migrating to 1.0.0

What to do

gm-markers

  • rename all gm-get-lat-lng attributes to gm-position
  • rename all gm-get-marker-options to gm-marker-options
  • add the gm-id attribute (see how to use it in the docs)

gm-polylines

  • rename all gm-get-path attributes to gm-path
  • rename all gm-get-polyline-options to gm-polyline-options
  • add the gm-id attribute (see how to use it in the docs)

Why it changed

The major change in 1.0.0 is the introduction of the gm-id property for gm-markers and gm-polylines. The reason for this change is that it doesn't make sense to uniquely identify a marker/object by it's position because (a) you may have multiple marker/objects with the same position and (b) the position of a marker/object might change over time. Furthermore, the gm-polylines directive was being unnecessarily limited in functionality (for one, gm-on-*event* and gm-events were not supported) because the 'position' of a polyline is a much more complex representation than the position of a marker. With unique ids for each polyline and marker, it becomes much easier to support more use cases and be smarter about when and how markers and polylines are updated.

Since I was making a breaking api change anyway, I decided to roll in renaming of some attributes whose names had been bothering me for a while.

There are even more changes that made it in to the release. The gmMapIdle event and the gmMarkersUpdate/gmPolylinesUpdate events, to name a few. See the changelog for a full list.