Do not zoom to GPS location if an element is selected

This commit is contained in:
pietervdvn 2021-11-15 16:57:04 +01:00
parent b5693304f2
commit b883cd87d0
2 changed files with 6 additions and 4 deletions

View file

@ -70,6 +70,7 @@ export default class GeoLocationHandler extends VariableUiElement {
constructor(
state: {
selectedElement: UIEventSource<any>;
currentUserLocation: FeatureSource,
leafletMap: UIEventSource<any>,
layoutToUse: LayoutConfig,
@ -183,7 +184,8 @@ export default class GeoLocationHandler extends VariableUiElement {
const latLonGiven = QueryParameters.wasInitialized("lat") && QueryParameters.wasInitialized("lon")
this.init(false, !latLonGiven && state.featureSwitchGeolocation.data);
const doAutoZoomToLocation = !latLonGiven && state.featureSwitchGeolocation.data && state.selectedElement.data !== undefined
this.init(false, doAutoZoomToLocation);
isLocked.addCallbackAndRunD(isLocked => {
if (isLocked) {