From 3fa075ad2d91ce476783e1208a8f85a8415bb498 Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Tue, 5 Mar 2024 09:57:37 +0100 Subject: [PATCH 1/6] Add a prop to disable feature click zoom --- .../components/StoreLocator/StoreLocator.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue b/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue index bd5b3db..4929860 100644 --- a/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue +++ b/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue @@ -111,6 +111,11 @@ type: [Function, Boolean], default: false, }, + + /** + * Disable the zoom when clicking on a Feature. + */ + disableFeatureClickZoom: Boolean, }); const emit = defineEmits(); @@ -266,6 +271,10 @@ const item = props.items.find(({ id }) => id === feature.properties.id); emit('cluster-feature-click', feature, event); + if (props.disableFeatureClickZoom) { + return; + } + if (item) { emit('select-item', item); selectedItem.value = item; From 3f6600e0cff2870e59096d323d6a974289adea58 Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Tue, 5 Mar 2024 10:02:51 +0100 Subject: [PATCH 2/6] Update docs --- packages/docs/components/StoreLocator/index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/docs/components/StoreLocator/index.md b/packages/docs/components/StoreLocator/index.md index 8dfcb2d..e0c464c 100644 --- a/packages/docs/components/StoreLocator/index.md +++ b/packages/docs/components/StoreLocator/index.md @@ -219,6 +219,13 @@ interface StoreLocatorClassesProp { Props to add a custom filtering on the `items` props. That is triggered on `onMapCreated` `onMapMoveend` event. +### `disableFeatureClickZoom` + +- Type `Boolean` +- Default `false` + +Disable the zoom on a feature click. + ## Events ### `map-created` From 7e9c35e66c94e85ded1f00fcc5ab848d35d3da6e Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Tue, 5 Mar 2024 10:17:01 +0100 Subject: [PATCH 3/6] Move the early return --- .../components/StoreLocator/StoreLocator.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue b/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue index 4929860..f68c31f 100644 --- a/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue +++ b/packages/vue-mapbox-gl/components/StoreLocator/StoreLocator.vue @@ -271,13 +271,14 @@ const item = props.items.find(({ id }) => id === feature.properties.id); emit('cluster-feature-click', feature, event); - if (props.disableFeatureClickZoom) { - return; - } - if (item) { emit('select-item', item); selectedItem.value = item; + + if (props.disableFeatureClickZoom) { + return; + } + unref(map).flyTo({ center: feature.geometry.coordinates, zoom: props.itemZoomLevel }); } } From 3fe9187562b598093b329815f672a1fc1e82dd85 Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Tue, 5 Mar 2024 13:36:10 +0100 Subject: [PATCH 4/6] Update the changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a531e66..5d22a3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format ## [Unreleased] +### Added + +- Add `disableFeatureClickZoom` prop to disable the zoom on feature click ([#136](https://github.com/studiometa/vue-mapbox-gl/pull/136)) + ## [v2.4.0](https://github.com/studiometa/vue-mapbox-gl/compare/2.3.4...2.4.0) (2024-02-23) ### Added From 6ef97c5c3dd7e61995f5132a1ccf17c7c162436a Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 5 Mar 2024 13:40:25 +0100 Subject: [PATCH 5/6] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d22a3c..d5db79e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file. The format ### Added -- Add `disableFeatureClickZoom` prop to disable the zoom on feature click ([#136](https://github.com/studiometa/vue-mapbox-gl/pull/136)) +- **StoreLocator:** add `disableFeatureClickZoom` prop to disable the zoom on feature click ([#136](https://github.com/studiometa/vue-mapbox-gl/pull/136)) ## [v2.4.0](https://github.com/studiometa/vue-mapbox-gl/compare/2.3.4...2.4.0) (2024-02-23) From fa3574cf0cff223cf99f9f0552c85a2e362e0ce2 Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Tue, 5 Mar 2024 13:44:23 +0100 Subject: [PATCH 6/6] Bump version number --- CHANGELOG.md | 2 ++ package-lock.json | 10 +++++----- package.json | 2 +- packages/demo/package.json | 2 +- packages/docs/package.json | 2 +- packages/vue-mapbox-gl/package.json | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5db79e..90496d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format ## [Unreleased] +## [v2.5.0](https://github.com/studiometa/vue-mapbox-gl/compare/2.4.0...2.5.0) (2024-03-05) + ### Added - **StoreLocator:** add `disableFeatureClickZoom` prop to disable the zoom on feature click ([#136](https://github.com/studiometa/vue-mapbox-gl/pull/136)) diff --git a/package-lock.json b/package-lock.json index e57fdff..2e8fbef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@studiometa/vue-mapbox-gl-workspace", - "version": "2.4.0", + "version": "2.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@studiometa/vue-mapbox-gl-workspace", - "version": "2.4.0", + "version": "2.5.0", "workspaces": [ "packages/*" ], @@ -18996,7 +18996,7 @@ }, "packages/demo": { "name": "@studiometa/vue-mapbox-gl-demo", - "version": "2.4.0", + "version": "2.5.0", "dependencies": { "@mapbox/mapbox-gl-geocoder": "^5.0.2", "@studiometa/vue-mapbox-gl": "*", @@ -19050,7 +19050,7 @@ }, "packages/docs": { "name": "@studiometa/vue-mapbox-gl-docs", - "version": "2.4.0", + "version": "2.5.0", "devDependencies": { "sass": "^1.71.1", "tailwindcss": "^3.4.1", @@ -19059,7 +19059,7 @@ }, "packages/vue-mapbox-gl": { "name": "@studiometa/vue-mapbox-gl", - "version": "2.4.0", + "version": "2.5.0", "license": "GPL-3.0-or-later", "devDependencies": { "@mapbox/mapbox-gl-geocoder": "^5.0.1", diff --git a/package.json b/package.json index 7e9f0de..167bfc4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@studiometa/vue-mapbox-gl-workspace", "private": true, - "version": "2.4.0", + "version": "2.5.0", "workspaces": [ "packages/*" ], diff --git a/packages/demo/package.json b/packages/demo/package.json index 976cb1c..1d4ce69 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -1,6 +1,6 @@ { "name": "@studiometa/vue-mapbox-gl-demo", - "version": "2.4.0", + "version": "2.5.0", "scripts": { "dev": "nuxt dev", "build": "nuxt build" diff --git a/packages/docs/package.json b/packages/docs/package.json index ac59a29..dcbe03d 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -2,7 +2,7 @@ "name": "@studiometa/vue-mapbox-gl-docs", "private": true, "type": "module", - "version": "2.4.0", + "version": "2.5.0", "scripts": { "dev": "vitepress", "build": "vitepress build" diff --git a/packages/vue-mapbox-gl/package.json b/packages/vue-mapbox-gl/package.json index aaa66ce..179153b 100644 --- a/packages/vue-mapbox-gl/package.json +++ b/packages/vue-mapbox-gl/package.json @@ -1,6 +1,6 @@ { "name": "@studiometa/vue-mapbox-gl", - "version": "2.4.0", + "version": "2.5.0", "description": "A small components library to use Mapbox GL in Vue 3.", "homepage": "https://github.com/studiometa/vue-mapbox-gl#readme", "bugs": {