SINTEF-9012 / PruneCluster

Fast and realtime marker clustering for Leaflet
MIT License
551 stars 132 forks source link

Method leafletView.PrepareLeafletMarker in examples doesn't seem to be executed. #168

Closed BobbyBabes closed 6 years ago

BobbyBabes commented 6 years ago

What is the purpose of rewriting PrepareLeafletMarker in this example: /examples/realworld.50000-categories.html ? https://github.com/SINTEF-9012/PruneCluster/blob/master/examples/realworld.50000-categories.html#L158-L164

leafletView.PrepareLeafletMarker = function (marker, data, category) {
    if (marker.getPopup()) {
        marker.setPopupContent(data.title + " - " + category);
    } else {
        marker.bindPopup(data.title + " - " + category);
    }
};

when I add console.log to log the category, nothing is logged.

leafletView.PrepareLeafletMarker = function (marker, data, category) {
    console.log(category);
    if (marker.getPopup()) {
        marker.setPopupContent(data.title + " - " + category);
    } else {
        marker.bindPopup(data.title + " - " + category);
    }
};

The same thing happens in the example without categories: /examples/realworld.50000.html.

fungiboletus commented 6 years ago

I think it's executed. Have you tried to zoom ? It's only executed when markers outside clusters are displayed.

BobbyBabes commented 6 years ago

You are right. With this particular example, I never drilled down to the unclustered stage (individual markers) because I expected that adding the category would only matter when clustered. Looks like I got some more digging to do. Thanks!

EDIT: I see now that the category is added to the title tooltip. How did i miss that? I'm taking a break now.