1.9.5 • Published 1 month ago

leaflet-path-drag v1.9.5

Weekly downloads
3,189
License
MIT
Repository
github
Last release
1 month ago

L.Path.Drag

npm version

Drag handler for Leaflet vector features. It adds dragging API and events of L.Marker to L.Polygon and L.Polyline.

If you are looking for this functionality combined with Leaflet.draw, take a look at Leaflet.draw.drag and Leaflet.Editable.Drag.

Demo

Usage

<script src="path/to/leaflet/"></script>
<script src="path/to/L.Path.Drag.js"></script>
...
var polygon = new L.Polygon([...], { draggable: true }).addTo(map);
// you can use the drag events just like with markers
polygon
    .on('dragstart', onDragStart)
    .on('drag',      onDrag)
    .on('dragend',   onDragEnd);

with browserify

npm install leaflet-path-drag
...

require('leaflet');
var handler = require('leaflet-path-drag');

Requires Leaflet@1.1.x

For Leaflet@0.7.x support use code from leaflet-0.7 branch

Enable/disable dragging

var polygon = new L.Polygon([...], { draggable: true }).addTo(map);
polygon.dragging.enable();
polygon.dragging.disable();

Info

It uses matrix transforms on SVG/VML paths, so part of it(src/L.Path.Transform) could be used for different transformations - skew/scale/etc - but you have to provide coordinates projection and handling yourself.

VML matrix transform tested in IE8, it has rendering glitches, but what can you expect.

License

The MIT License (MIT)

Copyright (c) 2015 Alexander Milevski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.9.5

1 month ago

1.9.4

1 month ago

1.8.0-beta.1

2 years ago

1.8.0-beta.3

2 years ago

1.8.0-beta.2

2 years ago

1.0.7

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

0.7.7

8 years ago

1.0.0

8 years ago

1.0.0-beta.11

8 years ago

0.1.16

8 years ago

1.0.0-beta.10

8 years ago

1.0.0-beta.9

8 years ago

1.0.0-beta.8

8 years ago

1.0.0-beta.7

8 years ago

1.0.0-beta.6

8 years ago

1.0.0-beta.5

8 years ago

1.0.0-beta.4

8 years ago

1.0.0-beta.3

8 years ago

1.0.0-beta.2

8 years ago

1.0.0-beta.1

8 years ago

0.1.15

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago