Socket
Socket
Sign inDemoInstall

leaflet-editable

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    leaflet-editable

Make geometries editable in Leaflet


Version published
Weekly downloads
9.7K
decreased by-13.75%
Maintainers
1
Install size
306 kB
Created
Weekly downloads
 

Changelog

Source

1.2.0

  • add editable:vertex:mouseover and editable:vertex:mouseout events (#159, thanks to @Git-Lior)
  • restrict large vertex icons to mobile only (cf #171, thanks to @tyrasd)
  • prevent to add a vertex on right click (cf #157)

Readme

Source

Build Status

Leaflet.Editable

Make geometries editable in Leaflet.

This is not a plug and play UI, and will not be. This is a minimal, lightweight, and fully extendable API to control editing of geometries. So you can easily build your own UI with your own needs and choices.

See the demo UI, an more examples below. This is also the drawing engine behind uMap.

Design keys:

  • only the core needs
  • no UI, instead hooks everywhere needed
  • everything programmatically controllable
  • MultiPolygon/MultiPolyline support
  • Polygons' holes support
  • touch support
  • tests

Install

You need Leaflet >= 1.0.0, and then include src/Leaflet.Editable.js.

Path dragging

If you want path dragging, you need to also include Path.Drag.js.

Quick start

Allow Leaflet.Editable in the map options:

var map = L.map('map', {editable: true});

Then, to start editing an existing feature, call the enableEdit method on it:

var polyline = L.polyline([[43.1, 1.2], [43.2, 1.3],[43.3, 1.2]]).addTo(map);
polyline.enableEdit();

If you want to draw a new line:

map.editTools.startPolyline();  // map.editTools has been created
                                // by passing editable: true option to the map

If you want to continue an existing line:

polyline.editor.continueForward();
// or
polyline.editor.continueBackward();

Examples

API

See the reference

Licence

Leaflet.Editable is released under the WTFPL licence.

Keywords

FAQs

Last updated on 05 Sep 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc