-
Notifications
You must be signed in to change notification settings - Fork 8
Ctrl + Zoom on overlay trigger page zoom (linux desktop) #30
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
Comments
Hi @brunob
I can't reproduce it:
It's been a while since I visited that page, but right now the overlay appears to me after several "scroll" attempts (I have to click on the map first to make it appear immediately). |
Here is a video showing the bug with firefox 135.0.1 on ubuntu 24.04. bug.webm |
It might be that setTimeout behaves differently in linux's event loop (or maybe not, who can say for sure..) leaflet-gesture-handling/src/index.js Lines 133 to 142 in d2e0a39
BTW, this is what i tried: Here it is a tampermonkey script you can play with: // ==UserScript==
// @name Set Gesture Handling Duration
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Set gesture handling duration on page load (Linux OS)
// @author Raruto
// @match https://raruto.github.io/leaflet-gesture-handling/*
// @supportURL https://github.com/Raruto/leaflet-gesture-handling/issues/30#issuecomment-2704855581
// @run-at document-start
// @unwrap
// ==/UserScript==
(async function() {
// 🤓 wait for leaflet.js
if (!window.L) {
await new Promise(r => Array.from(document.scripts).find(s => s.src.includes('leaflet.js')).addEventListener('load', r));
}
// 🥬 detect Linux OS
if (navigator.userAgent.toLowerCase().includes("linux")) {
window.L.Map.addInitHook(function(e) {
this.options.gestureHandlingOptions.duration = 700;
});
document.head.insertAdjacentHTML('beforeend', `<style>.leaflet-gesture-handling-warning:after { transition-duration:.8s }</style>`);
}
})(); 👋 Raruto |
Thx for the feedback.
I've also tried with |
Right now, I don't have a Linux OS to test it.
Like this: // ==UserScript==
// @name Set Gesture Handling Duration
// @namespace http://tampermonkey.net/
// @version 2.0
// @description Set gesture handling duration on page load (Linux OS)
// @author Raruto
// @match https://raruto.github.io/leaflet-gesture-handling/*
// @supportURL https://github.com/Raruto/leaflet-gesture-handling/issues/30#issuecomment-2711307252
// @run-at document-start
// @unwrap
// ==/UserScript==
(async function() {
// 🤓 wait for leaflet.js
if (!window.L) {
await new Promise(r => Array.from(document.scripts).find(s => s.src.includes('leaflet.js')).addEventListener('load', r));
}
// 🥬 detect Linux OS
if (navigator.userAgent.toLowerCase().includes("linux")) {
document.head.insertAdjacentHTML('beforeend', `
<style>
:root .leaflet-gesture-handling:after { display: none; }
:root .leaflet-gesture-handling-warning:after { display: flex; }
</style>`);
}
})(); Some further ideas:
leaflet-gesture-handling/src/index.js Line 40 in d2e0a39
leaflet-gesture-handling/src/index.js Lines 258 to 268 in d2e0a39
|
A bit like #11 but on desktop, when i use ctrl+zoom on the overlay this trigger page zoom.
This can be reproduced on https://raruto.github.io/leaflet-gesture-handling/examples/leaflet-gesture-handling.html
I can't reproduce on the orginal script demo https://elmarquis.github.io/Leaflet.GestureHandling/examples/ which hide the overlay instantly when you ctrl+zoom it.
I've tried to tweak the transitions https://github.com/Raruto/leaflet-gesture-handling/blob/master/src/index.css#L18 & https://github.com/Raruto/leaflet-gesture-handling/blob/master/src/index.css#L24 to 0 and it doesn't fix the bug.
The text was updated successfully, but these errors were encountered: