Fix back button to return to the map

This commit is contained in:
Pieter Vander Vennet 2020-10-01 20:36:42 +02:00
parent 929d07202f
commit cc75f5c4fd

View file

@ -14,7 +14,7 @@ export class FullScreenMessageBox extends UIElement {
private readonly returnToTheMap: UIElement; private readonly returnToTheMap: UIElement;
constructor(onClear: (() => void)) { constructor(onClear: (() => void)) {
super(); super(State.state.fullScreenMessage);
const self = this; const self = this;
State.state.fullScreenMessage.addCallbackAndRun(uiElement => { State.state.fullScreenMessage.addCallbackAndRun(uiElement => {
this._uielement = new Combine([State.state.fullScreenMessage.data]).SetStyle( this._uielement = new Combine([State.state.fullScreenMessage.data]).SetStyle(
@ -32,7 +32,6 @@ export class FullScreenMessageBox extends UIElement {
); );
}); });
this.ListenTo(State.state.fullScreenMessage);
this.HideOnEmpty(true); this.HideOnEmpty(true);
@ -50,7 +49,8 @@ export class FullScreenMessageBox extends UIElement {
window.onhashchange = function () { window.onhashchange = function () {
if (location.hash === "") { if (location.hash === "") {
// No more element: back to the map! // No more element: back to the map!
self._uielement?.setData(undefined); console.log("Clearing full screen message");
State.state.fullScreenMessage.setData(undefined);
onClear(); onClear();
} }
} }