Coder Social home page Coder Social logo

mazemap / leaflet.singleclick Goto Github PK

View Code? Open in Web Editor NEW

This project forked from outdooractive/leaflet-singleclick_0.7

8.0 5.0 3.0 13 KB

Allows Leaflet layers to fire 'singleclick' events

License: Apache License 2.0

HTML 57.39% JavaScript 42.61%

leaflet.singleclick's Introduction

Leaflet.singleclick

This plugin extends L.Evented to fire the singleclick event. A singleclick happens when clicking on something but not double-clicking for 500msec.

The timeout can be configured by setting the singleClickTimeout option on the relevant L.Evented, like so:

marker.options.singleClickTimeout = 250;
marker.on('singleclick', function(ev){ ... } );

Works with Leaflet 1.0.0-beta1 and greater. Does not work with 0.7.x.

Live example

http://mazemap.github.io/Leaflet.singleclick/

leaflet.singleclick's People

Contributors

dagjomar avatar ivansanchez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

leaflet.singleclick's Issues

Publish to npm

With Bower being in a maintenance only state, it would be helpful to publish this as a dependency to npm.

On touch devices dblclick is invoked before second click event

Tested on

  • Chrome on desktop with emulate touch
  • Chrome on iPhone 5
  • IE10 on desktop (L.Browser.touch === true && L.Browser.pointer === true)

To reproduce:

  • set up listener on map 'click' and 'dblclick' console log out event name
  • double click on map in desktop chrome
  • notice console log should read: "click, click, dblclick"
  • double tap on map in touch chrome
  • notice console log should read: "click, dblclick, click"

This causes listeners on singleclick to be invoked even on double tap because _scheduleSingleClick() is fired after_cancelSingleClick().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.