You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
514 B
24 lines
514 B
const formatUnits = require('./formatUnits')
|
|
|
|
let control
|
|
let unitSystems = {
|
|
si: 'metres',
|
|
imp: 'landmiles',
|
|
nautical: 'nauticalmiles',
|
|
m: 'metres'
|
|
}
|
|
|
|
register_hook('init', function () {
|
|
// Measurement plugin
|
|
if (L.control.polylineMeasure) {
|
|
control = L.control.polylineMeasure({
|
|
unit: unitSystems[formatUnits.settings.system]
|
|
}).addTo(map)
|
|
}
|
|
})
|
|
|
|
register_hook('format-units-refresh', () => {
|
|
if (control) {
|
|
control.options.unit = unitSystems[formatUnits.settings.system]
|
|
}
|
|
})
|