Skip to content

Manipulating the Map from the page controller #97

Description

@Chinow

Hi guys,

I used your awesome addon to do add a Map into an EmberApp
=> https://github.com/wwoof/webapp
=> https://app.wwoof.fr/hosts

I ran into a couple issues so I wanted to share them with you.
I wanted to use the Leaflet API to manage my map from the controller. However I was not able to access the map from the controller. Therefore I had to override an init method in the EmberLeaflet.MapView to forward the map Layer to the page controller:

export default EmberLeaflet.MapView.extend({
    [...]

    didCreateLayer: function () {

        // Get map init parameters from controller
        this._layer.setView(L.latLng(this.controller.get('lat'), this.controller.get('lon')), this.controller.get('mapZoom'), false);
        this.controller.set('mapLayer', this._layer);

        // declare moveEnd action sender
        this.moveend = function () {
            this.controller.send("mapChanged");
        };

        // continue Init
        this._super();
    }
});

Is there a better way of doing that? I think it's important to allow Map/Layer manipulation from a controller.

Also, if you want you could add a link to our App as an usage example of this addon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions