leaflet-draw-drag

0.4.8 • Public • Published

Leaflet.Draw.Drag

npm version

Drag feature functionality for Leaflet.draw.

Uses Leaflet.Path.Drag

Backwards compatibility

If you want leaflet@0.7.x + leaflet.draw@0.2.x support, use leaflet-0.7 branch or npm versions leaflet-draw-drag@^0.1.7

Demo

Usage

<script src="path/to/leaflet/"></script>
<script src="path/to/leaflet.draw.js"></script>
<script src="path/to/Edit.Poly.Drag.js"></script>
...
var drawnItems = new L.FeatureGroup().addTo(map);
// Initialise the draw control and pass it the FeatureGroup of editable layers
var drawControl = new L.Control.Draw({
  edit: {
    featureGroup: drawnItems
    edit: {
      moveMarkers: false // centroids, default: false
    }
  }
});
map.addControl(drawControl);
// aaand you are good to go, all vector paths are draggable in edit mode

with browserify

npm install leaflet-draw-drag
...

require('leaflet');
var drawControl = require('leaflet-draw-drag'); // requires leaflet-draw

Info

Uses and includes Leaflet.Path.Drag to extend vector features with drag functionality, so you can create draggable polygons and polylines programmatically if you have this one included in your app.

var polygon = new L.Polygon([...], { draggable: true }).addTo(map);
polygon
    .on('dragstart', onDragStart)
    .on('drag',      onDrag)
    .on('dragend',   onDragEnd);

Development

npm install && npm start

Build

npm run build

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.

Drag feature functionality for Leaflet.draw

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.4.8621latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.8621
0.4.7107
0.4.57
0.4.410
0.4.30
0.1.76
0.1.60
0.1.50
0.1.45
0.1.20
0.1.10
0.1.00
0.0.50
0.0.40
0.0.32
0.0.20
0.0.10

Package Sidebar

Install

npm i leaflet-draw-drag

Weekly Downloads

758

Version

0.4.8

License

MIT

Unpacked Size

59.1 kB

Total Files

12

Last publish

Collaborators

  • w8r