UNPKG

npmap.js

Version:

A JavaScript web mapping library, built as a Leaflet plugin, for the National Park Service.

29 lines (22 loc) 511 B
/* global L */ 'use strict'; var ScaleControl = L.Control.Scale.extend({ options: { metric: false } }); L.Map.mergeOptions({ scaleControl: false }); L.Map.addInitHook(function() { if (this.options.scaleControl) { var options = {}; if (typeof this.options.scaleControl === 'object') { options = this.options.scaleControl; } this.scaleControl = L.npmap.control.scale(options).addTo(this); } }); module.exports = function(options) { return new ScaleControl(options); };