Socket
Book a DemoInstallSign in
Socket

react-polygon-drawer

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-polygon-drawer

Draw polygon over any element

0.1.4
latest
Source
npmnpm
Version published
Weekly downloads
171
11.04%
Maintainers
2
Weekly downloads
 
Created
Source

react-polygon-drawer

Draw polygon over any element

NPM JavaScript Style Guide

Install

npm i react-polygon-drawer

Usage

import React from 'react'
import logo from './Demo.png'

import ReactPolygonDrawer from 'react-polygon-drawer'

const App = () => {
  return <div>
    <img src={logo}/>
    <ReactPolygonDrawer/>
  </div>
}

Props

Prop NameTypeDescriptionDefault Value
heightnumberPass height of the image400
widthnumberPass width of the image400
lineWidthnumber?Width of the line to be sketched on canvas3
lineColorstring?Color of the line to be sketched on canvas'#FF3333'
pointColorstring?Color of the point to be dotted on canvas'#FF3333'
fillColorstring?Color of the fill region of polygon'rgba(205, 92, 92, 0.5)'
disableAutoClosingboolean?if false, double click closes the polygon automatically, else select the closing coordinates manually by clickingfalse
proximitynumber?Approximated value near inital start point of polygon, in the vicinity of which if user clicks, polygon closes20
existingCoordinatesCoordinate[]List of {x,y} coordinates to be rendered-
minPointsnumber?Minimum number of points in polygon-
maxPointsnumber?Maximum number of points in polygon-
onFinish(coordinates: Coordinate[])=>voidCallback function once polygon is drawn-
onPoint(coordinate: Coordinate)=>voidCallback function once point is dotted-
/**
 * @typedef {Object} Coordinate
 * @prop {number} x
 * @prop {number} y
 */

For Contribution and Run Example

git clone "https://github.com/apra-Labs/react-polygon-drawer.git"
cd react-polygon-drawer
npm i
cd examples
npm i
npm start

License

MIT © apra-labs

Contributors

  • dpk-jha
  • mansi-rthd

Keywords

react

FAQs

Package last updated on 16 Dec 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.