Skip to content

๐Ÿงฉ LControlScale โ€‹

A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems.

๐Ÿงช Demo โ€‹

vue
<script setup lang="ts">
import { LControlScale, LMap, LTileLayer } from '@maxel01/vue-leaflet'
</script>

<template>
    <LMap ref="map" :zoom="2" :center="[47.41322, -1.219482]">
        <LTileLayer
            url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
            layer-type="base"
            name="OpenStreetMap"
        />
        <LControlScale position="bottomleft" />
    </LMap>
</template>

โš™๏ธ Props โ€‹

Prop nameDescriptionTypeReactiveDefaultRequired
maxWidthMaximum width of the control in pixels. The width is set dynamically to show round values (eg. 100, 200, 500).numberinitOnly-false
metricWhether to show the metric scale line (m/km).booleaninitOnly-false
imperialWhether to show the imperial scale line (mi/ft).booleaninitOnly-false
updateWhenIdleIf true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).booleaninitOnly-false

๐Ÿ”— Inherited props โ€‹

from ControlAbstractProps
Prop nameDescriptionTypeReactiveDefaultRequired
positionThe position of the control (one of the map corners). Possible values are topleft, topright, bottomleft or bottomright.ControlPositiontrue-false
from ComponentProps
Prop nameDescriptionTypeReactiveDefaultRequired
optionsLeaflet options to pass to the component constructor.TinitOnly-false

๐Ÿ“ก Emits โ€‹

EventArgumentsDescription
readyTTriggers when the component is ready

๐Ÿงญ Exposes โ€‹

NameTypeDescription
leafletObjectRef<Control.Scale | undefined>The underlying Leaflet instance. Can be used to directly interact with the Leaflet API (e.g. calling methods or accessing internal state).