Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen markercluster click event #421

Closed
markitosgv opened this issue Jul 15, 2014 · 4 comments
Closed

Listen markercluster click event #421

markitosgv opened this issue Jul 15, 2014 · 4 comments

Comments

@markitosgv
Copy link

Its possible to acces clusterclick, without overlays??

My initial map:

//map initial
    angular.extend($scope, {
        center: {
            autoDiscover: true
        },
        defaults: {
            scrollWheelZoom: false
        },
        layers: {
            baselayers: {
                osm: {
                    name: 'OpenStreetMap',
                    url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
                    type: 'xyz'
                }
            }
        }
    });

And then i call my own service to fecth markers data:

    //on load map
    $scope.$on('leafletDirectiveMap.load', function(event){

       api.getMarkersByProximity(function(data){
             $scope.markers.push(data);
        });

       });

Now i have a map with markers and clusters.
With this event i can listen when a marker is clicked, but not a cluster:

$scope.$on("leafletDirectiveMarkersClick", function(event, args){
        console.log($scope.markers[args]);
    });

Its possible to do?? thanks
I don´t want when cluster marker is clicked to expand child markers... i want to get child markers data to do another thing.

On official Leaflet.markercluster docs says:

markers.on('clusterclick', function (a) {
    console.log('cluster ' + a.layer.getAllChildMarkers().length);
});

Is any event directive to listen?

@joeljeske
Copy link

@markitosgv, have you found a way to listen for cluster events?

@rasmi
Copy link

rasmi commented Jun 15, 2015

Has anyone found any ways to listen besides dipping down into pure Leaflet (like @joeljeske did in #648)? As @markitosgv points out, this method relies on layers.

@nmccready
Copy link
Contributor

This issue was moved to angular-ui/ui-leaflet#31

@tombatossals
Copy link
Owner

I'm going to rework&redesign angular-leaflet-directive to be compatible with Leaflet v1.0. It will mantain almost all its functionality, and will be compatible with the current features of the directive, but I must start from a fresh point, so I'm going to close this issue. If you think it must be worked with the new version, please reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants