Skip to content

Commit

Permalink
patch refactored scrollWheelZoom and touchZoom conditionals
Browse files Browse the repository at this point in the history
After looking at the leaflet source code it looks like you can only
pass a boolean value or the string 'center'. Therefore I've made these
conditionals stricter as it doesn't support any other string value.
  • Loading branch information
jwarykowski committed Feb 28, 2018
1 parent c63eef3 commit d18b5c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export default class Map extends MapComponent<LeafletElement, Props> {
}

if (scrollWheelZoom !== fromProps.scrollWheelZoom) {
if (scrollWheelZoom === true || typeof scrollWheelZoom === 'string') {
if (scrollWheelZoom === true || scrollWheelZoom === 'center') {
this.leafletElement.scrollWheelZoom.enable()
} else {
this.leafletElement.scrollWheelZoom.disable()
Expand All @@ -282,7 +282,7 @@ export default class Map extends MapComponent<LeafletElement, Props> {
}

if (touchZoom !== fromProps.touchZoom) {
if (touchZoom === true || typeof touchZoom === 'string') {
if (touchZoom === true || touchZoom === 'center') {
this.leafletElement.touchZoom.enable()
} else {
this.leafletElement.touchZoom.disable()
Expand Down

0 comments on commit d18b5c9

Please sign in to comment.