mapbox-gl-draw-pinning-mode

0.1.2 • Public • Published

Mapbox-GL Draw Pinning Mode

npm

Custom mode for Mapbox GL Draw for pinning shared coordinates together during edit.

Demo

See a full example in the docs folder, or check at the Demo.

a GIF showing usage demo

Install

npm i mapbox-gl-draw-pinning-mode

or use CDN:

<script src="https://unpkg.com/mapbox-gl-draw-pinning-mode"></script>

Usage

import mapboxGlDrawPinningMode from "mapbox-gl-draw-pinning-mode";
// or global variable `mapboxGlDrawPinningMode` when using script tag

const draw = new MapboxDraw({
  modes: {
    ...MapboxDraw.modes,
    pinning_mode: mapboxGlDrawPinningMode,
  },
});

// inherited from, and acting similar to simple_select
draw.changeMode("pinning_mode");

This mode inherits simple_select mode from the mapbox-gl-draw, so the Behavior is quite the same.

Acknowledgement

this project is inspired from Pinning feature of leaflet-geoman (Pro) project.

Package Sidebar

Install

npm i mapbox-gl-draw-pinning-mode

Weekly Downloads

48

Version

0.1.2

License

MIT

Unpacked Size

2.64 MB

Total Files

10

Last publish

Collaborators

  • mh_sattarian