maps: use Leaflet.GestureHandling to avoid zooming on map during scroll (#39058)

This commit is contained in:
Frédéric Péters 2020-01-25 20:37:24 +01:00
parent 4bba415725
commit c2c1fcdf50
5 changed files with 7 additions and 1 deletions

1
debian/control vendored
View File

@ -23,6 +23,7 @@ Depends: ${misc:Depends}, ${python3:Depends},
python3-requests,
python3-vobject,
python3-xstatic-leaflet,
python3-xstatic-leaflet-gesturehandling,
uwsgi,
uwsgi-plugin-python3
Recommends: python3-dns,

View File

@ -123,6 +123,7 @@ setup(
'django-ckeditor<=4.5.3',
'django-ratelimit<3',
'XStatic-Leaflet',
'XStatic-Leaflet-GestureHandling',
'pyproj',
],
package_dir = { 'wcs': 'wcs' },

View File

@ -72,7 +72,9 @@ class HTTPResponse(quixote.http_response.HTTPResponse):
if script_name == 'qommon.map.js':
self.add_javascript(['jquery.js'])
self.add_javascript(['../xstatic/leaflet.js'])
self.add_javascript(['../xstatic/leaflet-gesture-handling.min.js'])
self.add_css_include('../xstatic/leaflet.css')
self.add_css_include('../xstatic/leaflet-gesture-handling.min.css')
self.add_javascript(['leaflet-gps.js'])
self.add_javascript(['../../i18n.js'])
if script_name == 'qommon.wysiwyg.js':

View File

@ -28,6 +28,8 @@ $(window).on('load', function() {
map_options.scrollWheelZoom = 'center';
map_options.doubleClickZoom = 'center';
map_options.maxBounds = null;
} else {
map_options.gestureHandling = true;
}
var map = L.map($(this).attr('id'), map_options);
var map_controls_position = $('body').data('map-controls-position') || 'topleft';

View File

@ -195,7 +195,7 @@ class StaticsDirectory(Directory):
'': ['web', 'qommon', 'django:gadjo', 'django:ckeditor'],
'xstatic': ['xstatic:jquery', 'xstatic:jquery_ui',
'xstatic:font_awesome', 'xstatic:opensans',
'xstatic:leaflet',],
'xstatic:leaflet', 'xstatic:leaflet_gesturehandling'],
}
@classmethod