From 2bead588fbe3e7dc79c19d969132851a7602e801 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 4 Dec 2021 12:20:24 +0100 Subject: [PATCH] Do not show quickswitch if background map switching is disabled --- Logic/State/FeatureSwitchState.ts | 4 ++-- UI/BigComponents/FilterView.ts | 2 +- UI/BigComponents/LeftControls.ts | 9 ++++++++- UI/DefaultGuiState.ts | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Logic/State/FeatureSwitchState.ts b/Logic/State/FeatureSwitchState.ts index 32aca8294..6dc25429b 100644 --- a/Logic/State/FeatureSwitchState.ts +++ b/Logic/State/FeatureSwitchState.ts @@ -16,7 +16,7 @@ export default class FeatureSwitchState { public readonly featureSwitchUserbadge: UIEventSource; public readonly featureSwitchSearch: UIEventSource; - public readonly featureSwitchBackgroundSlection: UIEventSource; + public readonly featureSwitchBackgroundSelection: UIEventSource; public readonly featureSwitchAddNew: UIEventSource; public readonly featureSwitchWelcomeMessage: UIEventSource; public readonly featureSwitchIframePopoutEnabled: UIEventSource; @@ -72,7 +72,7 @@ export default class FeatureSwitchState { (layoutToUse) => layoutToUse?.enableSearch ?? true, "Disables/Enables the search bar" ); - this.featureSwitchBackgroundSlection = featSw( + this.featureSwitchBackgroundSelection = featSw( "fs-background", (layoutToUse) => layoutToUse?.enableBackgroundLayerSelection ?? true, "Disables/Enables the background layer control" diff --git a/UI/BigComponents/FilterView.ts b/UI/BigComponents/FilterView.ts index 3bbfccb90..884289714 100644 --- a/UI/BigComponents/FilterView.ts +++ b/UI/BigComponents/FilterView.ts @@ -20,7 +20,7 @@ export default class FilterView extends VariableUiElement { const backgroundSelector = new Toggle( new BackgroundSelector(), undefined, - State.state.featureSwitchBackgroundSlection + State.state.featureSwitchBackgroundSelection ) super( filteredLayer.map((filteredLayers) => { diff --git a/UI/BigComponents/LeftControls.ts b/UI/BigComponents/LeftControls.ts index ef367abaa..0082f60c7 100644 --- a/UI/BigComponents/LeftControls.ts +++ b/UI/BigComponents/LeftControls.ts @@ -19,6 +19,7 @@ import BackgroundMapSwitch from "./BackgroundMapSwitch"; export default class LeftControls extends Combine { constructor(state: { + featureSwitchBackgroundSelection: UIEventSource; layoutToUse: LayoutConfig, featurePipeline: FeaturePipeline, currentBounds: UIEventSource, @@ -74,10 +75,16 @@ export default class LeftControls extends Combine { undefined, state.featureSwitchFilter ); + + const mapSwitch = new Toggle( + new BackgroundMapSwitch(state, state.backgroundLayer), + undefined, + state.featureSwitchBackgroundSelection + ) super([filterButton, downloadButtonn, - new BackgroundMapSwitch(state, state.backgroundLayer) + mapSwitch ]) this.SetClass("flex flex-col") diff --git a/UI/DefaultGuiState.ts b/UI/DefaultGuiState.ts index 537eb4b70..1df1891db 100644 --- a/UI/DefaultGuiState.ts +++ b/UI/DefaultGuiState.ts @@ -18,7 +18,7 @@ export class DefaultGuiState { this.welcomeMessageOpenedTab = UIEventSource.asFloat(QueryParameters.GetQueryParameter( "tab", "0", - `The tab that is shown in the welcome-message. 0 = the explanation of the theme,1 = OSM-credits, 2 = sharescreen, 3 = more themes, 4 = about mapcomplete (user must be logged in and have >${Constants.userJourney.mapCompleteHelpUnlock} changesets)` + `The tab that is shown in the welcome-message.` )); this.welcomeMessageIsOpened = QueryParameters.GetBooleanQueryParameter( "welcome-control-toggle",