Skip to content

Wrong event counting if IDs equal #26

@letmaik

Description

@letmaik

This control works based on an internal map that stores an event ID according to this code:

            getEventId: function(e) {
                if (e.id) {
                    return e.id;
                }
                else if (e.layer) {
                    return e.layer._leaflet_id;
                }
                return e.target._leaflet_id;
            },

This is quite problematic I think. The problem is, when I fire multiple dataloading events on the map instance, then these are registered as a single event only since the ID is identical for all of them (it is the map id) and therefore the spinner disappears once the first dataload event comes in, even though it should have been waiting for the others if it had counted correctly.

Why is this based on IDs anyway? It could be a simple counter, couldn't it? To not break the API and remove all the "loader" management functions (like addLoader and removeLoader), the plugin could store counts for each loader id instead of just true. Then this would support the case above and be fully backwards compatible.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions