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.
35 lines
1.2 KiB
Vue
35 lines
1.2 KiB
Vue
<!--
|
||
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>
|