Skip to content

Commit 333ccf2

Browse files
committed
Revert "show current location as blue dot - fix #430"
This reverts commit 8228f12.
1 parent 48ca9c8 commit 333ccf2

File tree

4 files changed

+5
-33
lines changed

4 files changed

+5
-33
lines changed

src/App.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
getQueryStore,
1212
getRouteStore,
1313
getSettingsStore,
14-
getCurrentLocationStore,
1514
} from '@/stores/Stores'
1615
import MapComponent from '@/map/MapComponent'
1716
import MapOptions from '@/map/MapOptions'
@@ -23,7 +22,6 @@ import { QueryStoreState, RequestState } from '@/stores/QueryStore'
2322
import { RouteStoreState } from '@/stores/RouteStore'
2423
import { MapOptionsStoreState } from '@/stores/MapOptionsStore'
2524
import { ErrorStoreState } from '@/stores/ErrorStore'
26-
import { CurrentLocationStoreState } from '@/stores/CurrentLocationStore'
2725
import Search from '@/sidebar/search/Search'
2826
import ErrorMessage from '@/sidebar/ErrorMessage'
2927
import useBackgroundLayer from '@/layers/UseBackgroundLayer'
@@ -47,7 +45,6 @@ import useExternalMVTLayer from '@/layers/UseExternalMVTLayer'
4745
import LocationButton from '@/map/LocationButton'
4846
import { SettingsContext } from '@/contexts/SettingsContext'
4947
import usePOIsLayer from '@/layers/UsePOIsLayer'
50-
import useCurrentLocationLayer from '@/layers/UseCurrentLocationLayer'
5148

5249
export const POPUP_CONTAINER_ID = 'popup-container'
5350
export const SIDEBAR_CONTENT_ID = 'sidebar-content'
@@ -62,7 +59,6 @@ export default function App() {
6259
const [pathDetails, setPathDetails] = useState(getPathDetailsStore().state)
6360
const [mapFeatures, setMapFeatures] = useState(getMapFeatureStore().state)
6461
const [pois, setPOIs] = useState(getPOIsStore().state)
65-
const [currentLocation, setCurrentLocation] = useState(getCurrentLocationStore().state)
6662

6763
const map = getMap()
6864

@@ -76,7 +72,6 @@ export default function App() {
7672
const onPathDetailsChanged = () => setPathDetails(getPathDetailsStore().state)
7773
const onMapFeaturesChanged = () => setMapFeatures(getMapFeatureStore().state)
7874
const onPOIsChanged = () => setPOIs(getPOIsStore().state)
79-
const onCurrentLocationChanged = () => setCurrentLocation(getCurrentLocationStore().state)
8075

8176
getSettingsStore().register(onSettingsChanged)
8277
getQueryStore().register(onQueryChanged)
@@ -87,7 +82,6 @@ export default function App() {
8782
getPathDetailsStore().register(onPathDetailsChanged)
8883
getMapFeatureStore().register(onMapFeaturesChanged)
8984
getPOIsStore().register(onPOIsChanged)
90-
getCurrentLocationStore().register(onCurrentLocationChanged)
9185

9286
onQueryChanged()
9387
onInfoChanged()
@@ -97,7 +91,6 @@ export default function App() {
9791
onPathDetailsChanged()
9892
onMapFeaturesChanged()
9993
onPOIsChanged()
100-
onCurrentLocationChanged()
10194

10295
return () => {
10396
getSettingsStore().deregister(onSettingsChanged)
@@ -109,7 +102,6 @@ export default function App() {
109102
getPathDetailsStore().deregister(onPathDetailsChanged)
110103
getMapFeatureStore().deregister(onMapFeaturesChanged)
111104
getPOIsStore().deregister(onPOIsChanged)
112-
getCurrentLocationStore().deregister(onCurrentLocationChanged)
113105
}
114106
}, [])
115107

@@ -124,7 +116,6 @@ export default function App() {
124116
useQueryPointsLayer(map, query.queryPoints)
125117
usePathDetailsLayer(map, pathDetails)
126118
usePOIsLayer(map, pois)
127-
useCurrentLocationLayer(map, currentLocation)
128119

129120
const isSmallScreen = useMediaQuery({ query: '(max-width: 44rem)' })
130121
return (
@@ -147,7 +138,6 @@ export default function App() {
147138
error={error}
148139
encodedValues={info.encoded_values}
149140
drawAreas={settings.drawAreasEnabled}
150-
currentLocation={currentLocation}
151141
/>
152142
) : (
153143
<LargeScreenLayout
@@ -158,7 +148,6 @@ export default function App() {
158148
error={error}
159149
encodedValues={info.encoded_values}
160150
drawAreas={settings.drawAreasEnabled}
161-
currentLocation={currentLocation}
162151
/>
163152
)}
164153
</div>
@@ -174,10 +163,9 @@ interface LayoutProps {
174163
error: ErrorStoreState
175164
encodedValues: object[]
176165
drawAreas: boolean
177-
currentLocation: CurrentLocationStoreState
178166
}
179167

180-
function LargeScreenLayout({ query, route, map, error, mapOptions, encodedValues, drawAreas, currentLocation }: LayoutProps) {
168+
function LargeScreenLayout({ query, route, map, error, mapOptions, encodedValues, drawAreas }: LayoutProps) {
181169
const [showSidebar, setShowSidebar] = useState(true)
182170
const [showCustomModelBox, setShowCustomModelBox] = useState(false)
183171
return (
@@ -228,7 +216,7 @@ function LargeScreenLayout({ query, route, map, error, mapOptions, encodedValues
228216
<div className={styles.popupContainer} id={POPUP_CONTAINER_ID} />
229217
<div className={styles.onMapRightSide}>
230218
<MapOptions {...mapOptions} />
231-
<LocationButton queryPoints={query.queryPoints} currentLocation={currentLocation} />
219+
<LocationButton queryPoints={query.queryPoints} />
232220
</div>
233221
<div className={styles.map}>
234222
<MapComponent map={map} />
@@ -241,7 +229,7 @@ function LargeScreenLayout({ query, route, map, error, mapOptions, encodedValues
241229
)
242230
}
243231

244-
function SmallScreenLayout({ query, route, map, error, mapOptions, encodedValues, drawAreas, currentLocation }: LayoutProps) {
232+
function SmallScreenLayout({ query, route, map, error, mapOptions, encodedValues, drawAreas }: LayoutProps) {
245233
return (
246234
<>
247235
<div className={styles.smallScreenSidebar}>
@@ -260,7 +248,7 @@ function SmallScreenLayout({ query, route, map, error, mapOptions, encodedValues
260248
<div className={styles.smallScreenMapOptions}>
261249
<div className={styles.onMapRightSide}>
262250
<MapOptions {...mapOptions} />
263-
<LocationButton queryPoints={query.queryPoints} currentLocation={currentLocation} />
251+
<LocationButton queryPoints={query.queryPoints} />
264252
</div>
265253
</div>
266254

src/index.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
getQueryStore,
1414
getRouteStore,
1515
getSettingsStore,
16-
getCurrentLocationStore,
1716
setStores,
1817
} from '@/stores/Stores'
1918
import Dispatcher from '@/stores/Dispatcher'
@@ -32,7 +31,6 @@ import MapFeatureStore from '@/stores/MapFeatureStore'
3231
import SettingsStore from '@/stores/SettingsStore'
3332
import { ErrorAction, InfoReceived } from '@/actions/Actions'
3433
import POIsStore from '@/stores/POIsStore'
35-
import CurrentLocationStore from '@/stores/CurrentLocationStore'
3634
import { setDistanceFormat } from '@/Converters'
3735
import { AddressParseResult } from '@/pois/AddressParseResult'
3836

@@ -63,7 +61,6 @@ setStores({
6361
pathDetailsStore: new PathDetailsStore(),
6462
mapFeatureStore: new MapFeatureStore(),
6563
poisStore: new POIsStore(),
66-
currentLocationStore: new CurrentLocationStore(),
6764
})
6865

6966
setMap(createMap())
@@ -78,7 +75,6 @@ Dispatcher.register(getMapOptionsStore())
7875
Dispatcher.register(getPathDetailsStore())
7976
Dispatcher.register(getMapFeatureStore())
8077
Dispatcher.register(getPOIsStore())
81-
Dispatcher.register(getCurrentLocationStore())
8278

8379
// register map action receiver
8480
const smallScreenMediaQuery = window.matchMedia('(max-width: 44rem)')

src/map/LocationButton.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@ import LocationOn from '@/map/location_on.svg'
99
import { useState } from 'react'
1010
import { tr } from '@/translation/Translation'
1111
import { getBBoxFromCoord } from '@/utils'
12-
import { ToggleCurrentLocation } from '@/stores/CurrentLocationStore'
13-
import { CurrentLocationStoreState } from '@/stores/CurrentLocationStore'
1412

15-
export default function LocationButton(props: { queryPoints: QueryPoint[]; currentLocation: CurrentLocationStoreState }) {
13+
export default function LocationButton(props: { queryPoints: QueryPoint[] }) {
1614
const [locationSearch, setLocationSearch] = useState('synched_map_or_initial')
17-
1815
return (
1916
<div
2017
className={styles.locationOnOff}
2118
onClick={() => {
22-
// First toggle location display
23-
Dispatcher.dispatch(new ToggleCurrentLocation(!props.currentLocation.enabled))
24-
25-
// Then handle the location button click for routing/centering
2619
setLocationSearch('search')
2720
onCurrentLocationButtonClicked(coordinate => {
2821
if (coordinate) {

src/stores/Stores.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import PathDetailsStore from '@/stores/PathDetailsStore'
77
import MapFeatureStore from '@/stores/MapFeatureStore'
88
import SettingsStore from '@/stores/SettingsStore'
99
import POIsStore from '@/stores/POIsStore'
10-
import CurrentLocationStore from '@/stores/CurrentLocationStore'
1110

1211
let settingsStore: SettingsStore
1312
let queryStore: QueryStore
@@ -18,7 +17,6 @@ let mapOptionsStore: MapOptionsStore
1817
let pathDetailsStore: PathDetailsStore
1918
let mapFeatureStore: MapFeatureStore
2019
let poisStore: POIsStore
21-
let currentLocationStore: CurrentLocationStore
2220

2321
interface StoresInput {
2422
settingsStore: SettingsStore
@@ -30,7 +28,6 @@ interface StoresInput {
3028
pathDetailsStore: PathDetailsStore
3129
mapFeatureStore: MapFeatureStore
3230
poisStore: POIsStore
33-
currentLocationStore: CurrentLocationStore
3431
}
3532

3633
export const setStores = function (stores: StoresInput) {
@@ -43,7 +40,6 @@ export const setStores = function (stores: StoresInput) {
4340
pathDetailsStore = stores.pathDetailsStore
4441
mapFeatureStore = stores.mapFeatureStore
4542
poisStore = stores.poisStore
46-
currentLocationStore = stores.currentLocationStore
4743
}
4844

4945
export const getSettingsStore = () => settingsStore
@@ -55,4 +51,3 @@ export const getMapOptionsStore = () => mapOptionsStore
5551
export const getPathDetailsStore = () => pathDetailsStore
5652
export const getMapFeatureStore = () => mapFeatureStore
5753
export const getPOIsStore = () => poisStore
58-
export const getCurrentLocationStore = () => currentLocationStore

0 commit comments

Comments
 (0)