doxa-maps/library/components/map-controls/ZoomOutButton.vue
Doxa Maps 726b11ae79 A lazy view that fails to load says so and offers Retry; map controls carry data-control
retryableAsyncComponent: after the three retries the pane rendered blank. It now shows
"This view couldn't load." with a Retry button (messages keys, 11 locales). Retry swaps in a
fresh async component, since Vue keeps a rejected load for the life of the page.

Each map control wrapper passes data-control (zoom-in, zoom-out, fullscreen, theme, location,
help, share) to its button: an untranslated hook for probes, where title and aria-label are
localised.
2026-09-28 11:42:54 +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 data-control="zoom-out" :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>