doxa-maps/library/components/map-controls/ZoomOutButton.vue
Doxa Maps e19697673d
Some checks are pending
Deploy to GitHub Pages / build (push) Waiting to run
Deploy to GitHub Pages / deploy (push) Blocked by required conditions
Doxa Maps — the map bundler, 7 production plugins and the Experimental shelf
2026-09-25 20:07:59 +00:00

35 lines
1.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
ZoomOutButton.vue — Decrements the map zoom level by one step.
Props:
map — the live mapboxgl.Map instance (Object, required)
isDark — theme flag forwarded from parent
disabled — grey out + block the click when the camera is already at the minZoom
floor. useMapInstance computes that floor from the container aspect, so
on a short panel zoomOut() would otherwise be a silent no-op; disabling
makes "at the limit" legible instead of looking like a dead button.
-->
<script setup>
import { useI18n } from 'vue-i18n'
import MapControlButton from './MapControlButton.vue'
const { t } = useI18n()
const props = defineProps({
map: { type: Object, default: null },
isDark: { type: Boolean, default: false },
disabled: { type: Boolean, default: false }
})
function zoomOut() {
if (props.disabled) return
// Discrete one-step zoom — see the note in ZoomInButton.vue.
props.map?.zoomOut()
}
</script>
<template>
<MapControlButton :is-dark="isDark" :disabled="disabled" :title="t('buttons.zoomOut')" @click="zoomOut">
<span style="font-size:22px;line-height:1;font-weight:600;">−</span>
</MapControlButton>
</template>