Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-leaflet-semicircle

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-leaflet-semicircle

React wrapper of leaflet-semicircle

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
94
decreased by-59.13%
Maintainers
1
Weekly downloads
 
Created
Source

react-leaflet-semicircle

Greenkeeper badge

React wrapper of leaflet-semicircle for react-leaflet.

Semicircle vector layers for Leaflet maps. Extends L.Circle and L.CircleMarker.

Tested with Leaflet 1.4.0 and React-Leaflet 2.1.4

Installation

npm install react-leaflet-semicircle --save

Usage

Complete example with react-leaflet

import { Map, TileLayer } from 'react-leaflet';
import { SemiCircle, SemiCircleMarker } from 'react-leaflet-semicircle';

<Map center={[51.505, -0.09]} zoom={13}>
    <TileLayer
        url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
        attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
    />
    <SemiCircle
        position={[51.505, -0.09]}
        radius={2000}
        startAngle={90}
        stopAngle={180}
    />
    <SemiCircleMarker
        position={[51.505, -0.09]}
        radius={20}
        startAngle={90}
        stopAngle={180}
    />
</Map>;

<SemiCircle />

<SemiCircle
    position={[51.505, -0.09]}
    radius={2000}
    startAngle={90}
    stopAngle={180}
/>
Props
NameTypeExampleDescription
position [required]L.LatLng[] or Array[number, number][51.505, -0.09]Latitude and Longitude of the semicircle center
radius [required]number2000Radius of the semicircle in metres
startAnglenumber90Starting bearing of the semicircle
stopAnglenumber180Ending bearing of the semicircle

All other options from L.Circle are also supported. View them here

<SemiCircleMarker />

<SemiCircleMarker position={[51.505, -0.09]} startAngle={90} stopAngle={180} />
Props
NameTypeExampleDescription
position [required]L.LatLng[] or Array[number, number][51.505, -0.09]Latitude and Longitude of the semicirclemarker center
startAnglenumber90Starting bearing of the semicirclemarker
stopAnglenumber180Ending bearing of the semicirclemarker

All other options from L.CircleMarker are also supported. View them here

Component methods

Each component comes with methods that can be accessed via React Refs.

Setup
this.semiCircleRef = React.createRef();

// ----

<SemiCircle
    position={[51.505, -0.09]}
    radius={2000}
    startAngle={90}
    stopAngle={180}
    ref={this.semiCircleRef}
/>;
setDirection(direction, size)

Use setDirection(direction, size) to display a semicircle of size degrees at direction.

this.semiCircleRef.current.setDirection(90, 90);
setStartAngle(angle)

Set the start angle of the semicircle to angle

this.semiCircleRef.current.setStartAngle(90);
setStopAngle(angle)

Set the stop angle of the semicircle to angle

this.semiCircleRef.current.setStopAngle(90);

Keywords

FAQs

Package last updated on 13 Jan 2019

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