@sswroom/leaflet-drawtext
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

leaflet-drawText

A leaflet plugin which adds an icon to draw text on map.

Features

  • Draw text on map

Download

You can either download this repo directly or install via NPM.

npm install @sswroom/leaflet-drawtext

Options

You can pass a number of options to the plugin to control various settings.

Option Type Default Description
title string 'Print map' Sets the text which appears as the tooltip of the print/export button
position Leaflet control position 'topleft' Positions the print button
layer Layer null The layer for adding new labels
buttonClass string null The class name of the dialog button
dialogClass string null The class name of the dialog content
beforedialogshow Function null Call when just before dialog show
dialogMessage string 'Input label content' Dialog message text
addButton string 'Add' Add button text
cancelButton string 'Cancel' Cancel button text
dialogMargin number 20 Margin of dialog box

Example

import * as drawText from "leaflet-drawText";

drawText.create({
	title: 'My awesome print button',
	position: 'bottomright',
	buttonClass: "button"
}).addTo(map);

Methods / Using programmatically

Method Options Description
updateOption(name, value) Update options dynamitically Update the options at runtime.
var textPlugin = drawText.create().addTo(map); 
textPlugin.updateOption('buttonClass', 'button');

Readme

Keywords

Package Sidebar

Install

npm i @sswroom/leaflet-drawtext

Weekly Downloads

1

Version

1.0.2

License

none

Unpacked Size

8.74 kB

Total Files

5

Last publish

Collaborators

  • sswroom