npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-leaflet-draw-fork

v0.19.0

Published

React component for leaflet-draw

Downloads

8

Readme

React-Leaflet-Draw

React component build on top of React-Leaflet that integrate leaflet-draw feature.

Install

npm install react-leaflet-draw

Getting started

First, include leaflet-draw styles in your project

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.2/leaflet.draw.css"/>

or by including

node_modules/leaflet-draw/dist/leaflet.draw.css

You might need to add one more rule missing in the current css:

  .sr-only {
    display: none;
  }

It's important to wrap EditControl component into FeatureGroup component from react-leaflet. The elements you draw will be added to this FeatureGroup layer, when you hit edit button only items in this layer will be edited.

import { Map, TileLayer, FeatureGroup, Circle } from 'react-leaflet';
import { EditControl } from "react-leaflet-draw"

const Component = () => (
  <FeatureGroup>
    <EditControl
      position='topright'
      onEdited={this._onEditPath}
      onCreated={this._onCreate}
      onDeleted={this._onDeleted}
      draw={{
        rectangle: false
      }}
    />
    <Circle center={[51.51, -0.06]} radius={200} />
  </FeatureGroup>
);

For more details on how to use this plugin check the example.

You can pass more options on draw object, this informations can be found here

EditControl API

Props

|name |type |description | |----------------|----------------------------|------------------------------------------------------| |position |string |control group position | |draw |object |enable/disable draw controls | |edit |object |enable/disable edit controls | |onEdited |function |hook to leaflet-draw's draw:edited event | |onCreated |function |hook to leaflet-draw's draw:created event | |onDeleted |function |hook to leaflet-draw's draw:deleted event | |onMounted |function |hook to leaflet-draw's draw:mounted event | |onEditStart |function |hook to leaflet-draw's draw:editstart event | |onEditStop |function |hook to leaflet-draw's draw:editstop event | |onDeleteStart |function |hook to leaflet-draw's draw:deletestart event | |onDeleteStop |function |hook to leaflet-draw's draw:deletestop event | |onDrawStart |function |hook to leaflet-draw's draw:drawstart event | |onDrawStop |function |hook to leaflet-draw's draw:drawstop event | |onDrawVertex |function |hook to leaflet-draw's draw:drawvertex event | |onEditMove |function |hook to leaflet-draw's draw:editmove event | |onEditResize |function |hook to leaflet-draw's draw:editresize event | |onEditVertex |function |hook to leaflet-draw's draw:editvertex event |

Links to docs