Skip to main content

alphaThis is a new frontend component. Help us improve it and give your feedback on Slack.

Scale Bar Plugin

Displays the current map scale and updates as the user zooms.

Usage

import createScaleBarPlugin from '@defra/interactive-map/plugins/scale-bar'
const scaleBarPlugin = createScaleBarPlugin({
units: 'metric'
})
const interactiveMap = new InteractiveMap({
plugins: [scaleBarPlugin]
})

Options

Options are passed to the factory function when creating the plugin.


units

Type:
'metric' | 'imperial'
Default:
'metric'

The unit system used to display the scale. 'metric' shows metres and kilometres, 'imperial' shows feet and miles.

createScaleBarPlugin({ units: 'imperial' })

manifest

Type:
Partial<PluginManifest>

Overrides for the plugin's buttons, panels and controls, matched by id. See PluginDescriptor.manifest.


Methods

This plugin does not expose any public methods.

Events

This plugin does not emit any custom events.