You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@mapbox-controls/ruler

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox-controls/ruler

Measure distance between points on a map

3.0.0
latest
Source
npmnpm
Version published
Weekly downloads
2.4K
7.79%
Maintainers
0
Weekly downloads
 
Created
Source

<< all controls

📏 @mapbox-controls/ruler

Control to measure distance between points on a map.

npm i @mapbox-controls/ruler
import RulerControl from '@mapbox-controls/ruler';
import '@mapbox-controls/ruler/src/index.css';

map.addControl(new RulerControl(), 'bottom-right');
map.on('ruler.on', () => console.log('Ruler activated'));
map.on('ruler.off', () => console.log('Ruler deactivated'));

Options

export type ControlOptions = {
    units?: import("@turf/helpers").Units;
    labelFormat?: (n: number) => string;
    lineLayout?: import("mapbox-gl").LineLayerSpecification["layout"];
    linePaint?: import("mapbox-gl").LineLayerSpecification["paint"];
    markerLayout?: import("mapbox-gl").CircleLayerSpecification["layout"];
    markerPaint?: import("mapbox-gl").CircleLayerSpecification["paint"];
    labelLayout?: import("mapbox-gl").SymbolLayerSpecification["layout"];
    labelPaint?: import("mapbox-gl").SymbolLayerSpecification["paint"];
    invisible?: boolean;
};

Events

eventdescription
ruler.onruler activated
ruler.offruler deactivated

Methods

Methods are useful for programmatic control (when option invisible is true):

  • activate(): void; - activate controls
  • deactivate(): void; - deactivate control
  • addCoordinate(coordinate: [number, number]): void; - add new coordinate

FAQs

Package last updated on 29 Aug 2024

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