Closed qwertydude closed 3 years ago
Hi Chris, there may be a bug in the application logic, please try to check the following points to verify:
Regards, Raruto
Thanks.
This is what I've found.
In Leafletjs:
Map.js line 1712 sets the gestureHandlingOptions to the hardcoded values (i.e. duration:1700)
return new Map(id, options);
Map.js line 127 sets the options from my custom options, thus also setting my values to gestureHandlingOptions
options = Util.setOptions(this, options);
Map.js line 156 resets the gestureHandlingOptions to the hardcoded values (i.e. duration:1700)
this.callInitHooks();
I know it's not your code, but do you think that is a bug? Or a quirk? Is there a way around it?
Thanks
Hi chris, I don't think it's a core issue, but mostly a problem of leaflet-ui or leaflet-gesture-handling.
Try to take a closer look at the lines that I pointed out earlier to try to better understand how it actually works.
Also try playing with the following lines to make sure everything is okay:
L.Map.mergeOptions({
gestureHandling: true,
gestureHandlingOptions: { duration: 850 }, // FIXED VALUE
})
L.Map.addInitHook(function() {
this.options.gestureHandling = true;
this.options.gestureHandlingOptions = { duration: 850 }; // FIXED VALUE
});
Reference: Extending Leaflet (class theory)
Happy testing, Raruto
Thanks, Raruto
Getting out of my depth a bit. Tho have learnt a bit this week! For this project, the time for me to resolve this the right way is no really justifiable. So will just re-build our own with the duration set to something smaller.
All that said... I've had to deactivate gesture handling anyway because the 2 finger move wasn't working on mobile, and again, I can't justify anymore time on this at the moment.
Do appreciate all your help though.
Thanks heaps.
One should investigate further, but at least this works as expected:
var map = L.map('map', { gestureHandling: true });
// update from defaults: { text: {}, duration: 1700 }
L.extend(map.options.gestureHandlingOptions, { duration: 850 });
Raruto
Hi I wanted change the duration that the overlay advising Use ⌘ + scroll to zoom the map is displayed.
I discovered the gestureHandlingOptions.duration so figured all I needed to do was add this to my map options
gestureHandlingOptions: { duration: 850 },
But it didn't work.Is this not a customisable option?