Trigger mouse events when cursor is "almost" over a layer
JavaScript HTML
Latest commit 2c25a7c Sep 21, 2016 @SBats SBats committed on GitHub Merge pull request #5 from NBTSolutions/gh-pages
Failed to load latest commit information.
src update repo structure Sep 21, 2016
test update repo structure Sep 21, 2016
.gitignore update repo structure Sep 21, 2016
.travis.yml Start testing, WIP Oct 6, 2013
LICENSE Import code from PathGrab Sep 24, 2013 Update Oct 7, 2013
index.html fix index.html Sep 21, 2016
package.json update package.json Sep 21, 2016


This plugin allows to detect mouse click and overing events on lines, with a tolerance distance.

It is useful if paths are drawn with a very small weight, or for clicks detection on mobile devices, for which finger precision can be a problem.

Play with online demo.

It requires Leaflet.GeometryUtil.

Build Status


    var map ='map');
    var lines = L.geoJson(...);

    map.on('almost:over', function (e) {
        alert('Almost clicked !');


Events triggered when mouse is almost over a layer :

  • almost:over (latlng, layer)
  • almost:move (latlng, layer)
  • almost:out (layer)
  • almost:click (latlng, layer)
  • almost:dblclick (latlng, layer)


Makina Corpus