0.3.1 • Published 4 months ago

leaflet-doubletapdragzoom v0.3.1

Weekly downloads
12
License
MIT
Repository
github
Last release
4 months ago

npm.io npm.io npm.io npm.io

Leaflet.DoubleTapDragZoom

This plugin implements double-tap-and-drag zoom feature, which allows to zoom in / out with one hand! :tada:

Inspired by Google Maps and Apple Maps.

Demo: https://cherniavskii.github.io/Leaflet.DoubleTapDragZoom/

Installation

NPM

npm install --save leaflet-doubletapdrag leaflet-doubletapdragzoom

import L from 'leaflet';
import 'leaflet-doubletapdrag';
import 'leaflet-doubletapdragzoom';

Loading from unpkg.com:

Add the following scripts to the head:

<script src="https://unpkg.com/leaflet"></script>
<script src="https://unpkg.com/leaflet-doubletapdrag"></script>
<script src="https://unpkg.com/leaflet-doubletapdragzoom"></script>

Usage

Now you can pass supported options to map. See Options section for more details.

var map = L.map('map', {
  doubleTapDragZoom: true,
  doubleTapDragZoomOptions: {
    reverse: false,
  },
})

To achieve Google Maps-like behavior, use this configuration:

var map = L.map('map', {
  doubleTapDragZoom: 'center',
  doubleTapDragZoomOptions: {
    reverse: true,
  },
})

Options

OptionTypeDefaultDescription
doubleTapDragZoomBoolean|String*Whether the map can be zoomed by double-tap-and-drag gesture. If passed 'center', it will zoom to the center of the view regardless of where the touch event (finger) was. Enabled for touch-capable web browsers except for old Androids
doubleTapDragZoomOptionsObject--Plugin options, see available options below
doubleTapDragZoomOptions.reverseBooleanfalseIf true, zoom drag direction will be reversed - dragging up will zoom out, dragging down will zoom in
0.3.1

4 months ago

0.3.0

3 years ago

0.2.0

6 years ago

0.1.0

6 years ago