hosuaby / Leaflet.SmoothMarkerBouncing

Smooth animation of marker bouncing for Leaflet.
BSD 2-Clause "Simplified" License
146 stars 28 forks source link

Problem with overloaded _on #17

Closed Satrige closed 3 years ago

Satrige commented 6 years ago

I have a problem with current realisation of overloaded _on:

L.Marker.prototype._on = function (type, fn, context) {
        var newFn = function (event) {
            if (type === 'click') {
                document.activeElement.blur();
            }

            fn.call(this, event);
        };

        oldOn.call(this, type, newFn, context);
    };

Because of wrapping functions for all events into newFn function, the method _off from Leaflet library doesn't work correctly. It has such line:

if (l.fn === fn) {

And this checking always returns false because of wrapping.

I think that it is possible to solve the problem if just add to css something like this: outline: none; Or mayby add 'click' event for markers.

hosuaby commented 3 years ago

Fixed in v2.0.0