Only show locatecontrol button in leaflet map when we can do geolocation

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-09-07 17:43:16 +02:00
parent c198b21587
commit 3564b69db8
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -19,7 +19,10 @@
:zoomInTitle="$t('Zoom in')" :zoomInTitle="$t('Zoom in')"
:zoomOutTitle="$t('Zoom out')" :zoomOutTitle="$t('Zoom out')"
></l-control-zoom> ></l-control-zoom>
<v-locatecontrol :options="{ icon: 'mdi mdi-map-marker' }" /> <v-locatecontrol
v-if="canDoGeoLocation"
:options="{ icon: 'mdi mdi-map-marker' }"
/>
<l-marker <l-marker
:lat-lng="[lat, lon]" :lat-lng="[lat, lon]"
@add="openPopup" @add="openPopup"
@ -152,6 +155,10 @@ export default class Map extends Vue {
(this.$t("© The OpenStreetMap Contributors") as string) (this.$t("© The OpenStreetMap Contributors") as string)
); );
} }
get canDoGeoLocation(): boolean {
return window.isSecureContext;
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>