Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-clicktolerance

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-clicktolerance

Adds clickTolerance option to canvas powered layers

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Leaflet.ClickTolerance

Adds a clickTolerance option to canvas powered layers. Increases the clickable area of vector layers beyond their visible extent. Useful when the stroke width of your vector layer is too narrow to create an usable clickable area.

Modern Leaflet allows you te set a global tolerance on the renderer (Leaflet docs). This plugin could still be useful if you want to set different tolerances for individual layers.

Setup

Standalone

Include the javascript file on your page after Leaflet.

<script src="https://unpkg.com/leaflet-clicktolerance/src/index.js" />

Node

Import the leaflet-clicktolerance package.

import 'leaflet';
import 'leaflet-clicktolerance';

Usage

This plugin extends the Path options with a new option "clickTolerance". Set this option for layers you want to increase the clickable area of.

var layer = L.polyline([[0,0], [0,10]], {
    clickTolerance: 10,
});

Make sure you are using the canvas renderer

const map = L.map('map', {
    preferCanvas: true
});

or

const map = L.map('map', {
    renderer: new L.Canvas()
});

Keywords

FAQs

Package last updated on 06 Apr 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc