geoman-io / leaflet-geoman

πŸ‚πŸ—ΊοΈ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

Problem with snap on ALT + TAB #1128

Closed RenaudAubert closed 2 years ago

RenaudAubert commented 2 years ago

Hi ! As mentionned in the doc holding ALT disable snapping.

My problem is that when I press ALT + TAB to change the current window, snapping is disabled but when I focus again on the page with leaflet and geoman-leaflet snappinng is still disabled. I'm using the latest version (2.11.4) and I noticed a fix was released in the previous version but I'm still having this issue.

Here's a JSFiddle

STEPS to reproduce

  1. Draw a rectangle
  2. Once rectangle drawn, select Draw Polygons. Snapping will work as usual
  3. ALT+Tab to another window and then come back to the JSFiddle window, now snapping is disabled

I might hve missed it but if this is a wanted behaviour is there a way to have snapping but disable the geoman alt key event? I have this implemented where I'm overriding isAltKeyPressed to always return false

map.pm.Keyboard.isAltKeyPressed = function () {
    return false;
};

EDIT: pressing ALT again re-enable snapping but I find this not ideal for our customers.

Falke-Design commented 2 years ago

Is working for me, I jumped away with alt+tab and back, also I tried to jump away and come with the mouse back but snapping is always working. snapping

Can you please make a video of what you are doing or a step by step explaination when you use alt+tab, when mouse etc.

RenaudAubert commented 2 years ago

@Falke-Design Thank you for your quick reply.

Here's a video with the problem leaflet-geoman-bug

Falke-Design commented 2 years ago

This is only a problem with Chrome. Firefox is working as expected. Thank you.

RenaudAubert commented 2 years ago

Thanks, I confirm that there is no problem on Firefox and Opera GX or at least I was unable to reproduce it. But it is present on Chrome and Edge which same as Opera GX are Chromium based browser Β―_(ツ)_/Β―

Falke-Design commented 2 years ago

@RenaudAubert can you check if it works with Chrome 100 for you? I does work now with the latest Chrome version for me

RenaudAubert commented 2 years ago

@Falke-Design Hi! I have the latest Chrome version on Windows 100.0.4896.127 and the snapping problem is still happening.

Falke-Design commented 2 years ago

@RenaudAubert can you please check if #1167 works for you.

RenaudAubert commented 2 years ago

@Falke-Design Hi! I checked on Chrome and Edge an it works great no more snapping problem. Thank you πŸ™