Skip to content

kostar111/Leaflet.AlmostOver

 
 

Repository files navigation

Leaflet.AlmostOver

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

Usage

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

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

Events

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)

Authors

Makina Corpus

About

Trigger mouse events when cursor is "almost" over a layer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published