forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
9b7052767a
49 changed files with 1744 additions and 1414 deletions
|
@ -1,10 +1,16 @@
|
|||
import ThemeViewState from "../../Models/ThemeViewState"
|
||||
import Hash from "./Hash"
|
||||
import { MenuState } from "../../Models/MenuState"
|
||||
import { AndroidPolyfill } from "./AndroidPolyfill"
|
||||
import { IndexedFeatureSource } from "../FeatureSource/FeatureSource"
|
||||
import { Feature } from "geojson"
|
||||
import { UIEventSource } from "../UIEventSource"
|
||||
|
||||
export default class ThemeViewStateHashActor {
|
||||
private readonly _state: ThemeViewState
|
||||
private readonly _state: {
|
||||
indexedFeatures: IndexedFeatureSource,
|
||||
selectedElement: UIEventSource<Feature>,
|
||||
guistate: MenuState
|
||||
}
|
||||
private isUpdatingHash = false
|
||||
|
||||
public static readonly documentation = [
|
||||
|
@ -17,7 +23,7 @@ export default class ThemeViewStateHashActor {
|
|||
"",
|
||||
"The possible hashes are:",
|
||||
"",
|
||||
MenuState.pageNames.map((tab) => "`" + tab + "`").join(","),
|
||||
MenuState.pageNames.map((tab) => "`" + tab + "`").join(",")
|
||||
]
|
||||
|
||||
/**
|
||||
|
@ -29,7 +35,11 @@ export default class ThemeViewStateHashActor {
|
|||
* As such, we use a change in the hash to close the appropriate windows
|
||||
*
|
||||
*/
|
||||
constructor(state: ThemeViewState) {
|
||||
constructor(state: {
|
||||
indexedFeatures: IndexedFeatureSource,
|
||||
selectedElement: UIEventSource<Feature>,
|
||||
guistate: MenuState,
|
||||
}) {
|
||||
this._state = state
|
||||
AndroidPolyfill.onBackButton(() => this.back(), {
|
||||
returnToIndex: state.featureSwitches.featureSwitchBackToThemeOverview
|
||||
|
@ -146,26 +156,8 @@ export default class ThemeViewStateHashActor {
|
|||
* Returns 'true' if an action was taken
|
||||
* @private
|
||||
*/
|
||||
private back() {
|
||||
console.log("Received back!")
|
||||
private back(): boolean {
|
||||
const state = this._state
|
||||
if (state.previewedImage.data) {
|
||||
state.previewedImage.setData(undefined)
|
||||
return true
|
||||
}
|
||||
if(state.searchState.showSearchDrawer.data){
|
||||
state.searchState.showSearchDrawer.set(false)
|
||||
return true
|
||||
}
|
||||
if (state.guistate.closeAll()) {
|
||||
return true
|
||||
}
|
||||
if (state.selectedElement.data) {
|
||||
state.selectedElement.setData(undefined)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
|
||||
return state.guistate.closeAll()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue