Socket
Socket
Sign inDemoInstall

leaflet-doubletapdragzoom

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    leaflet-doubletapdragzoom

Leaflet plugin that implements double-tap-and-drag zoom feature for zooming in / out with one hand


Version published
Weekly downloads
141
decreased by-29.5%
Maintainers
1
Install size
14.9 kB
Created
Weekly downloads
 

Changelog

Source

0.3.1 (2024-01-06)

  • Fix freezing map for non correct gesture (#13)

Readme

Source

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

Keywords

FAQs

Last updated on 06 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc