Skip to content

Commit

Permalink
chore: remove track of pin marker #427
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Nov 20, 2024
1 parent 96ef4f7 commit 1d3f4a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
6 changes: 1 addition & 5 deletions components/MainMap/MapFeatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default defineNuxtComponent({
const device = useDevice()
const { config } = storeToRefs(useSiteStore())
const mapStore = useMapStore()
const { center, selectedFeature, pinMarker, teritorioCluster } = storeToRefs(mapStore)
const { center, selectedFeature, teritorioCluster } = storeToRefs(mapStore)
const mapStyleLoaded = ref(false)
return {
Expand All @@ -134,7 +134,6 @@ export default defineNuxtComponent({
mapBase: ref<InstanceType<typeof MapBase>>(),
mapStore,
mapStyleLoaded,
pinMarker,
selectedFeature,
teritorioCluster,
}
Expand Down Expand Up @@ -204,9 +203,6 @@ export default defineNuxtComponent({
},
selectedFeature() {
if (this.pinMarker)
this.pinMarker.addTo(this.map as Map)
this.showSelectedFeature()
},
Expand Down
15 changes: 1 addition & 14 deletions stores/map.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { defineStore } from 'pinia'
import { type FitBoundsOptions, type LngLatLike, type Marker, Point } from 'maplibre-gl'
import type { FitBoundsOptions } from 'maplibre-gl'
import type { TeritorioCluster } from '@teritorio/maplibre-gl-teritorio-cluster'
import type { ApiPoi, ApiPoiProperties } from '~/lib/apiPois'
import type { LatLng, Pitch } from '~/utils/types'
import { Mode } from '~/utils/types'
import { pinMarkerRender } from '~/lib/clusters'

interface State {
boundOptions?: FitBoundsOptions
center: LatLng
mode: Mode
pinMarker: Marker | null
pitch: Pitch
selectedFeature: ApiPoi | null
teritorioCluster: TeritorioCluster | null
Expand All @@ -21,7 +19,6 @@ export const mapStore = defineStore('map', {
boundOptions: undefined,
center: { lng: 0, lat: 0 },
mode: Mode.BROWSER,
pinMarker: null,
pitch: 0,
selectedFeature: null,
teritorioCluster: null,
Expand All @@ -36,9 +33,6 @@ export const mapStore = defineStore('map', {

actions: {
setSelectedFeature(feature: ApiPoi | null) {
this.pinMarker?.remove()
this.pinMarker = null

if (!feature) {
this.selectedFeature = null
this.teritorioCluster?.resetSelectedFeature()
Expand Down Expand Up @@ -68,13 +62,6 @@ export const mapStore = defineStore('map', {
})

goodFeature.properties = cleanProperties

if (feature.properties.internalType === 'address') {
const { coordinates } = feature.geometry as GeoJSON.Point
// @ts-expect-error: type is too deep
this.pinMarker = pinMarkerRender(coordinates as LngLatLike, new Point(0, 0))
this.teritorioCluster?.resetSelectedFeature()
}
}

this.selectedFeature = goodFeature
Expand Down

0 comments on commit 1d3f4a7

Please sign in to comment.