forked from MapComplete/MapComplete
Fix: opening the popup if defined in the hash
This commit is contained in:
parent
1c4cf78a03
commit
196d76d9dc
3 changed files with 174 additions and 75 deletions
|
@ -23,6 +23,10 @@ import ScrollableFullScreen from "./Base/ScrollableFullScreen";
|
|||
import Translations from "./i18n/Translations";
|
||||
import SimpleAddUI from "./BigComponents/SimpleAddUI";
|
||||
import StrayClickHandler from "../Logic/Actors/StrayClickHandler";
|
||||
import Lazy from "./Base/Lazy";
|
||||
import ShowDataMultiLayer from "./ShowDataLayer/ShowDataMultiLayer";
|
||||
import StaticFeatureSource from "../Logic/FeatureSource/Sources/StaticFeatureSource";
|
||||
import FilteredLayer from "../Models/FilteredLayer";
|
||||
|
||||
export class DefaultGuiState {
|
||||
public readonly welcomeMessageIsOpened;
|
||||
|
@ -81,12 +85,22 @@ export default class DefaultGUI {
|
|||
constructor(state: FeaturePipelineState, guiState: DefaultGuiState) {
|
||||
this.state = state;
|
||||
this._guiState = guiState;
|
||||
const self = this;
|
||||
|
||||
if (state.layoutToUse.customCss !== undefined) {
|
||||
Utils.LoadCustomCss(state.layoutToUse.customCss);
|
||||
}
|
||||
|
||||
|
||||
this.SetupUIElements();
|
||||
this.SetupMap()
|
||||
|
||||
}
|
||||
|
||||
|
||||
private SetupMap(){
|
||||
const state = this.state;
|
||||
const guiState = this._guiState;
|
||||
|
||||
// Attach the map
|
||||
state.mainMapObject.SetClass("w-full h-full")
|
||||
.AttachTo("leafletDiv")
|
||||
|
@ -96,8 +110,28 @@ export default class DefaultGUI {
|
|||
state
|
||||
)
|
||||
|
||||
this.InitWelcomeMessage();
|
||||
|
||||
new ShowDataLayer({
|
||||
leafletMap: state.leafletMap,
|
||||
layerToShow: AllKnownLayers.sharedLayers.get("home_location"),
|
||||
features: state.homeLocation,
|
||||
enablePopups: false,
|
||||
})
|
||||
|
||||
state.leafletMap.addCallbackAndRunD(_ => {
|
||||
// Lets assume that all showDataLayers are initialized at this point
|
||||
state.selectedElement.ping()
|
||||
State.state.locationControl.ping();
|
||||
return true;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private SetupUIElements(){
|
||||
const state = this.state;
|
||||
const guiState = this._guiState;
|
||||
|
||||
const self =this
|
||||
Toggle.If(state.featureSwitchUserbadge,
|
||||
() => new UserBadge(state)
|
||||
).AttachTo("userbadge")
|
||||
|
@ -119,36 +153,21 @@ export default class DefaultGUI {
|
|||
|
||||
}
|
||||
|
||||
new Toggle(self.InitWelcomeMessage(),
|
||||
Toggle.If(state.featureSwitchIframePopoutEnabled, iframePopout),
|
||||
new Toggle(new Lazy(() => self.InitWelcomeMessage()),
|
||||
Toggle.If(state.featureSwitchIframePopoutEnabled, iframePopout),
|
||||
state.featureSwitchWelcomeMessage
|
||||
).AttachTo("messagesbox");
|
||||
|
||||
new LeftControls(state, guiState).AttachTo("bottom-left");
|
||||
new RightControls(state).AttachTo("bottom-right");
|
||||
State.state.locationControl.ping();
|
||||
|
||||
new CenterMessageBox(state).AttachTo("centermessage");
|
||||
document
|
||||
.getElementById("centermessage")
|
||||
.classList.add("pointer-events-none");
|
||||
|
||||
|
||||
new ShowDataLayer({
|
||||
leafletMap: state.leafletMap,
|
||||
layerToShow: AllKnownLayers.sharedLayers.get("home_location"),
|
||||
features: state.homeLocation,
|
||||
enablePopups: false,
|
||||
})
|
||||
|
||||
state.leafletMap.addCallbackAndRunD(_ => {
|
||||
// Lets assume that all showDataLayers are initialized at this point
|
||||
state.selectedElement.ping()
|
||||
return true;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private InitWelcomeMessage() {
|
||||
private InitWelcomeMessage() : BaseUIElement{
|
||||
const isOpened = this._guiState.welcomeMessageIsOpened
|
||||
const fullOptions = new FullWelcomePaneWithTabs(isOpened, this._guiState.welcomeMessageOpenedTab, this.state);
|
||||
|
||||
|
@ -180,7 +199,7 @@ export default class DefaultGUI {
|
|||
|
||||
public setupClickDialogOnMap(filterViewIsOpened: UIEventSource<boolean>, state: FeaturePipelineState) {
|
||||
|
||||
function setup(){
|
||||
function setup() {
|
||||
let presetCount = 0;
|
||||
for (const layer of state.layoutToUse.layers) {
|
||||
for (const preset of layer.presets) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue