From 374ffb30c5062e4b4c00dee23ffe6fd401d9432c Mon Sep 17 00:00:00 2001 From: Andrew Slack Date: Wed, 8 Mar 2023 17:29:31 +0100 Subject: [PATCH] - Adding min-zoom to the map object (we already have max-zoom) - Adding the details to the readme file --- docs/src/components/map.md | 16 ++++++++++++++++ src/components/map.vue | 6 ++++++ src/main.js | 3 +++ 3 files changed, 25 insertions(+) diff --git a/docs/src/components/map.md b/docs/src/components/map.md index 45992f7..0077e0a 100644 --- a/docs/src/components/map.md +++ b/docs/src/components/map.md @@ -104,6 +104,22 @@ You can also disable specific UI components: /> ``` +## Max and Min Zoom + +You can set the maximum and minimum zoom levels for the map: + +```html + +``` + +- Max zoom specifies how far the user can zoom in, 18-20 is normally the max. +- Min zoom is how far they can zoom out, 0-3 is normally the min. + + ## Access Google Maps instance You can easily access the Map instance by accessing `ref` in your component: diff --git a/src/components/map.vue b/src/components/map.vue index bbfe431..9f6539e 100644 --- a/src/components/map.vue +++ b/src/components/map.vue @@ -36,6 +36,12 @@ const props = { type: Number, noBind: true, }, + minZoom: { + required: false, + twoWay: true, + type: Number, + noBind: true, + }, heading: { type: Number, twoWay: true, diff --git a/src/main.js b/src/main.js index da8a42d..371b28d 100644 --- a/src/main.js +++ b/src/main.js @@ -17,8 +17,10 @@ import buildComponent from './components/build-component' import MountableMixin from './utils/mountableMixin' import { Env } from './utils/env' let GMapApi = null +let googleMapsObject = null export { + googleMapsObject, loadGMapApi, Marker, Polyline, @@ -82,6 +84,7 @@ function makeGMapApiPromiseLazy(options) { // Things to do once the API is loaded function onApiLoaded() { GMapApi.gmapApi = {} + googleMapsObject = window.google return window.google }