dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
197 stars 47 forks source link

Added ability to store markers by a user provided id, rather than the markers position #30

Closed wpalahnuk closed 10 years ago

wpalahnuk commented 10 years ago

I've made it so that the user can set an id in the marker options, which is then used to store the marker in the markers hash. Currently if no id is set it will still use the marker position as the hash. I thought I'd see what you thought about this approach before I go any further.

This approach is a bit unwieldy, but it should be backwards compatible with peoples current code

What I'd like to do is take out all the "internal" code that stores the markers by position and make the id mandatory, similar to gm-get-lat-lng. Users could still store markers by position by setting this new required id attribute to the markers position.

I need to add more to the comments and tests, but I thought I'd share what I've done so far to get some feedback.

kevin1024 commented 10 years ago

Just some feedback that this was more or less a drop-in fix for my problem. :+1:

The Travis tests are failing due to some jshint errors.

dylanfprice commented 10 years ago

Hey wpalahunk,

First of all thanks a ton for doing this. Sorry it took me so long to get around to reviewing it.

Since it's mostly a proof of concept at this stage I didn't give any inline feedback, but here are my general thoughts on the matter:

I'll be thinking about this some more and hopefully we can put together a decent implementation in the next week. Let me know if you have any thoughts. Once again, thanks for your contributions so far!

wpalahnuk commented 10 years ago

When I have some time over the next few days I'll update this PR

dylanfprice commented 10 years ago

Cool, I'll trying to find a good chunk of time to merge your PR and finish this feature off. Hopefully soon...

wpalahnuk commented 10 years ago

I've updated the PR,

I moved the id to an attribute and deleted the old latlng bases functions getMarker, addMarker, etc and replaced them with id based ones getMarkerById, addMarkerById, etc.

dylanfprice commented 10 years ago

Sweet. I have started merging in your PR, I'm combining it with a refactor I've wanted to do for a while. You can see the progress in the markers-by-id branch.

I decided to just go ahead and make breaking api changes since I don't have the bandwidth to deal with the added complexity of supporting legacy apis. Expect to see a release soon!