leaflet-groupedlayercontrol icon indicating copy to clipboard operation
leaflet-groupedlayercontrol copied to clipboard

Double click on the legend propagates to the map in Chrome

Open kingrollo opened this issue 8 years ago • 5 comments

Google Chrome is now touch-enabled, so L.Browser.touch returns true, meaning line 91 is called instead of lines 93 & 94.

I'm guessing these lines are intended to correct the UX on mobile devices rather than Chrome?

kingrollo avatar May 17 '17 22:05 kingrollo

The behaviour is strange... The basic example works fine also in chrome, the advanced example no..

The only difference in the code is the leaflet version

@kingrollo I do not understand if your proposal code change is the solution of the problem..??

rmarzocchi84 avatar Sep 25 '17 10:09 rmarzocchi84

@kingrollo Those lines were likely copied verbatim from the Leaflet version of the layers class. It's possible the leaflet implementation changed as well. I'd be happy to merge a PR related to that kind of bug.

ismyrnow avatar Oct 05 '17 13:10 ismyrnow

@ismyrnow Is the latest equivalent code in L.Control.Layers at line 182 and line 183? Looks as though it might have changed significantly since the code was originally copied, but it doesn't look impossible to fix...

kingrollo avatar Oct 06 '17 21:10 kingrollo

My current workaround looks like:

var layerControl = L.control.groupedLayers(baseMaps, overlays).addTo(this.map);
L.DomEvent.disableClickPropagation(layerControl._container);
L.DomEvent.disableScrollPropagation(layerControl._container);

This solved the issue so far.

karlitos avatar Oct 25 '17 15:10 karlitos

Kinda late but I added:

    // ... ~ line 240 in the .js
    input.layerId = L.Util.stamp(obj.layer);
    input.groupID = obj.group.id;
    L.DomEvent.on(input, 'click', this._onInputClick, this);

    // I added these lines to keep the control from acting wacky on Chrome
    var stop = L.DomEvent.stopPropagation;
    L.DomEvent.on(input, 'mousedown', stop)
              .on(input, 'touchstart', stop)
              .on(input, 'dblclick', stop)
              .on(input, 'mousewheel', stop)
              .on(input, 'MozMozMousePixelScroll', stop)

eclectocrat avatar Aug 04 '21 15:08 eclectocrat