gabesmed / ember-leaflet

Ember + Leaflet = Fun with maps
gabesmed.github.io/ember-leaflet
MIT License
164 stars 35 forks source link

Initialize L.Icon.Default.imagePath #109

Closed Awem closed 9 years ago

Awem commented 9 years ago

This PR prevents Leaflet from failing to detect L.Icon.Default.imagePath. As of now, usage of markers (e.g. via MarkerCollectionLayer) will fail with:

Couldn't autodetect L.Icon.Default.imagePath, set it manually.

This is because the way the library is loaded prevents it from detecting the path correctly (see here for further details: http://stackoverflow.com/a/14703995/2637573).

miguelcobain commented 9 years ago

Yes.

I was already using it in tests: https://github.com/gabesmed/ember-leaflet/blob/ember-cli-es6/tests%2Funit%2Flayers%2Fmarker-test.js#L11

miguelcobain commented 9 years ago

@AW-UC we should do it in an initializer, like this: https://github.com/csantero/ember-cli-ember-leaflet/blob/master/app%2Finitializers%2Fleaflet-shim.js

If we do it in init that code runs every time a map instance is created. Not necessary.

Awem commented 9 years ago

yes, that's much better. I guess an extensible initializer is the way to go.

Awem commented 9 years ago

@miguelcobain I created a new PR: https://github.com/gabesmed/ember-leaflet/pull/110