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

Prevent maps from zooming when the page is scrolled. #520

Merged
merged 2 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion betty/plugin/maps/assets/js/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import leafletStyle from 'leaflet/dist/leaflet.css' // eslint-disable-line no-un
import leafletMarkerIconImage from 'leaflet/dist/images/marker-icon.png'
import leafletMarkerIcon2xImage from 'leaflet/dist/images/marker-icon-2x.png'
import leafletMarkerShadowImage from 'leaflet/dist/images/marker-shadow.png'
import { GestureHandling } from 'leaflet-gesture-handling'
import 'leaflet-gesture-handling/dist/leaflet-gesture-handling.css' // eslint-disable-line no-unused-vars
import configuration from './configuration.json'

L.Map.addInitHook('addHandler', 'gestureHandling', GestureHandling)

let mapCount = 0

function initializePlaceLists () {
Expand All @@ -22,7 +26,9 @@ function initializePlaceList (placeList) {
const mapArea = placeList.getElementsByClassName('map')[0]
mapArea.id = (++mapCount).toString()

const map = L.map(mapArea.id)
const map = L.map(mapArea.id, {
gestureHandling: true
})

// Build the attribution layer.
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
Expand Down
3 changes: 2 additions & 1 deletion betty/plugin/maps/assets/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"core-js": "^3.6.5",
"css-loader": "^3.6.0",
"file-loader": "^6.0.0",
"leaflet": "^1.6.0",
"leaflet": "~1.6.0",
"leaflet-gesture-handling": "^1.1.8",
"mini-css-extract-plugin": "^0.9.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
Expand Down