New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-craft

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-craft

Zoopla inspired freehand polygon creation using Leaflet.js.

  • 4.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Leaflet-Craft

DEMO: https://sagarpreet-chadha.github.io/Leaflet-Craft/example/index

npm version


npm : https://www.npmjs.com/package/leaflet-craft

Extends https://github.com/Wildhoney/Leaflet.FreeDraw made by WildHoney and adds following functionalities to it:

  1. Adds Undo-Redo feature to Polygons.
Screenshot 2019-10-07 at 1 35 47 AM
  1. Adds Delete 1 marker feature by right clicking it.

  2. Adds Delete multiple markers by drawing circle around them :)

Screenshot 2019-10-07 at 1 42 05 AM
  1. Adds Control Bar to easily change MODES - Create, Edit, Delete Polygon, Delete 1 Marker, Delete multiple Markers.
Screenshot 2019-10-07 at 1 48 57 AM
  1. Calculates AREA (in metre square) of polygon which changes dynamically on editing the polygon. Stored with key polygonArea in each polygon's leaflet object.

export const polygonArea = Symbol('freedraw/polygonArea') We use TURF Area function to calculate the area.

  1. Add Hooks:

We can subscribe to following Event listeners and can pass a callback function to be executed. Callback function can be asynchronous as well, also the return value should be TRUE to continue the event (create/edit/delete) else if your callback function returns False then that event is forfeited. This is implemented by ES6 promise.

  • Polygon created: Started
  • Polygon created: Ended
  • Polygon edit: Started
  • Polygon edit: Ended
  • Polygon delete: Started
  • Polygon delete: Ended

Work in PROGRESS:

  1. Conversion to Typescript.
  2. Adding functionality to create Polygon via clicking (similar to Leaflet.Draw).
  3. Extending React-Leaflet to support React apps.

ABOUT:

Thank you @wildhoney, @ankeetmaini and other contributors :heart: . This library is actively maintained by @sagarpreet-chadha .

Keywords

FAQs

Package last updated on 11 May 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc