Registry / maps / jakodev-test-lfdraw

jakodev-test-lfdraw

JSON →
library2.8.8jsnpmunverified

A Leaflet plugin for free-hand drawing, editing, and merging of polygons on map layers. Version 2.8.8 is the current stable release; it is a fork based on ale-leaflet (itself a fork of Leaflet 1.x). It provides an intuitive UX for creating geospatial boundaries with features like polygon concave hull, simplification, edge addition, and shape modification. Compared to alternatives like L.Pather (polylines), FreeDraw focuses on polygon workflows. It depends on jakodev-test-lf (Leaflet fork) as a peer dependency and ships as ESM primarily. Release cadence is irregular; no recent updates since 2021.

npm install jakodev-test-lfdraw
INSTALL
IMPORT
SIG · JAKODEV-TEST-LFDRA
J
jakodev-test-lfdraw
mapsjavascriptv2.8.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FreeDraw
import FreeDraw from 'jakodev-test-lfdraw'
const FreeDraw = require('jakodev-test-lfdraw')
Package is ESM-only; CommonJS require() will fail.
FreeDraw (as default)
import FreeDraw from 'jakodev-test-lfdraw'
import { FreeDraw } from 'jakodev-test-lfdraw'
FreeDraw is a default export, not a named export. Named import will result in undefined.
L
import L from 'jakodev-test-lf'
import L from 'leaflet'
This plugin requires the specific jakodev-test-lf (Leaflet fork), not the original leaflet package, due to internal API differences.

Shows basic setup: import the Leaflet fork and FreeDraw, initialize map, add FreeDraw layer, listen for marker events, and set mode.

import L from 'jakodev-test-lf'; import FreeDraw from 'jakodev-test-lfdraw'; const map = new L.Map('map', { center: [51.505, -0.09], zoom: 13 }); const freeDraw = new FreeDraw(); map.addLayer(freeDraw); freeDraw.on('markers', event => { console.log('Polygon created/edited:', event.latLngs); }); // Optionally set mode: ALL, NONE, CREATE, EDIT, DELETE, APPEND, or EDIT_CREATE freeDraw.setMode(FreeDraw.MODES.CREATE);
Debug
Known issues
gotchaRequires specific Leaflet fork (jakodev-test-lf), not the official leaflet package. Using official Leaflet will cause runtime errors or missing methods.
fix
Replace 'leaflet' with 'jakodev-test-lf' in your package.json and imports.
affects: >=2.0.0
deprecatedThe original Leaflet.FreeDraw (npm: leaflet-freedraw) is deprecated in favor of this fork. However, documentation may still reference the old package.
fix
Use 'jakodev-test-lfdraw' instead of 'leaflet-freedraw'.
affects: >=2.0.0
gotchaESM-only package. If your project uses CommonJS (require), you must use dynamic import() or switch to ESM.
fix
Change 'require' calls to ES module imports, or use dynamic import: const FreeDraw = (await import('jakodev-test-lfdraw')).default;
affects: >=2.0.0
gotchaThe 'markers' event fires on the freeDraw instance, not on the map. Listening on map will not work.
fix
Attach the event listener directly to the FreeDraw instance: freeDraw.on('markers', ...);
affects: >=2.0.0
gotchaFreeDraw internally uses SVG; it may not work in browsers that lack SVG support (very old browsers).
fix
Ensure target browsers support SVG, or use a polyfill.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'addLayer')
Importing 'leaflet' instead of 'jakodev-test-lf' leads to missing or incompatible L.Map class.
fix
Install and import from 'jakodev-test-lf' instead of 'leaflet'.
Module not found: Can't resolve 'ale-leaflet'
Outdated documentation references the original 'ale-leaflet' package name.
fix
Use 'jakodev-test-lf' as the Leaflet fork dependency.
Warning: FreeDraw is not a constructor
Using named import ({ FreeDraw }) instead of default import.
fix
Change import to: import FreeDraw from 'jakodev-test-lfdraw';
Upgrade
Version history
2.8.8latest on npm
Audit
Dependencies
jakodev-test-lfrequiredRequired as a peer dependency; provides the L.Map, L.Layer, and SVG rendering that FreeDraw extends.
Agent activity
42 hits · last 30 days
node
38
Resources
jakodev-test-lfdraw — npm install jakodev-test-lfdraw · libregistry