miguelcobain/ember-leaflet

Q: leaflet-gesture-handling

basz opened this issue · 3 comments

basz commented

Hi,

I'm trying to create an addon that provide leaflet-gesture-handling. https://github.com/elmarquis/Leaflet.GestureHandling

Could you advise me on how to add it's required options to the LeafletMap that does the map instantiation?

<LeafletMap @lat={{52.362}} @lng={{4.86325}} @zoom={{13}} @gestureHandling={{true}} @gestureHandlingOptions={{hash duration=5000}} as |layers|>
    <layers.tile @url="https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"/>
  </LeafletMap>

I need to plugin into the LeafletMap component I think

var map = L.map("map", {
    /* ... initial options */
    gestureHandling: true,
    gestureHandlingOptions: {
        duration: 5000
    }
});
basz commented

I've added the following to an initializer and that seems to work... Works for all maps, but that is fine I guess.

L.Map.mergeOptions({
    gestureHandling: true,
    gestureHandlingOptions: {
      text: {
        touch: "Hey bro, use two fingers to move the map",
        scroll: "Hey bro, use ctrl + scroll to zoom the map",
        scrollMac: "Hey bro, use \u2318 + scroll to zoom the map"
      },
      duration: 5000
    }
  });
basz commented

here we go: https://github.com/bushbaby/ember-leaflet-gesture-handling

I like this leaflet family. Any plans to update things?

@basz at the moment there is no way to add arguments to <LeafletMap through addons. That would be an interesting feature to have. It would certainly involve using the ember-leaflet service, and pulling new arguments from there.

But I think your addon looks fine, you worked around the limitation really well.

I like this leaflet family. Any plans to update things?

What do you mean by "update things"?