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

Double click on the legend propagates to the map in Chrome #51

Open
kingrollo opened this issue May 17, 2017 · 5 comments
Open

Double click on the legend propagates to the map in Chrome #51

kingrollo opened this issue May 17, 2017 · 5 comments

Comments

@kingrollo
Copy link

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?

@rmarzocchi84
Copy link

rmarzocchi84 commented Sep 25, 2017

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..??

@ismyrnow
Copy link
Owner

ismyrnow commented Oct 5, 2017

@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.

@kingrollo
Copy link
Author

@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...

@karlitos
Copy link

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.

@eclectocrat
Copy link

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)

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

5 participants