Skip to content

mnisvdn/Leaflet.DraggableEnhancer

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

Leaflet.DraggableEnhancer

This plugin "enhances" the default L.Draggable class.
By default, the L.Draggable class is instanciated to allow dragging some objects around, like L.Map (which results in panning action in this case).

The fact is, the L.Draggable binds the events related to drag (mousedown, mouseup, mousemove, ...) to the main document root, which can cause problem if your map has to be instanciated within a <div> you do not master, and has an event.stopPropagation() executed with an handler bound to the mousemove event for example.
The result is, as long as your mouse will be over this <div>, the map panning won't work.

L.Draggable Issue

This plugin fixes this issue, and also takes care of handling other classes relying on L.Draggable, such as L.Map.BoxZoom.

It can also be found here, from from the official Leaflet Plugins repository, under the #Events category.

Tested only with Leaflet 1.0+
Goes untested with previous versions 0.7-

The minified version for production can found in the dist folder.
You can find source code in both ES5 and ES6.

About

A tiny enhancer of the L.Draggable class to handle cases where one of the map parents prevents event propagation which results in map panning not working

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published