1.0.2 • Published 1 year ago

@sswroom/leaflet-drawtext v1.0.2

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

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.

OptionTypeDefaultDescription
titlestring'Print map'Sets the text which appears as the tooltip of the print/export button
positionLeaflet control position'topleft'Positions the print button
layerLayernullThe layer for adding new labels
buttonClassstringnullThe class name of the dialog button
dialogClassstringnullThe class name of the dialog content
beforedialogshowFunctionnullCall when just before dialog show
dialogMessagestring'Input label content'Dialog message text
addButtonstring'Add'Add button text
cancelButtonstring'Cancel'Cancel button text
dialogMarginnumber20Margin 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

MethodOptionsDescription
updateOption(name, value)Update options dynamiticallyUpdate the options at runtime.
var textPlugin = drawText.create().addTo(map); 
textPlugin.updateOption('buttonClass', 'button');
1.0.2

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago