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
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
.gitattributes
README.md
leaflet.draggableenhancer.es6.js
leaflet.draggableenhancer.js
package.json

README.md

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.