mapcomplete/UI/FullScreenMessageBoxHandler.ts

34 lines
1 KiB
TypeScript
Raw Normal View History

import {UIElement} from "./UIElement";
import State from "../State";
import Combine from "./Base/Combine";
/**
* Handles the full screen popup on mobile
*/
export default class FullScreenMessageBox extends UIElement {
2020-11-15 13:56:20 +00:00
private _content: UIElement;
2021-01-07 03:50:12 +00:00
constructor() {
2020-11-16 00:59:30 +00:00
super(State.state.fullScreenMessage);
this.HideOnEmpty(true);
}
2020-06-29 01:12:44 +00:00
InnerRender(): string {
2020-09-12 21:15:17 +00:00
if (State.state.fullScreenMessage.data === undefined) {
return "";
}
2020-11-15 13:56:20 +00:00
this._content = State.state.fullScreenMessage.data;
2021-01-07 03:50:12 +00:00
return new Combine([this._content]).SetClass("fullscreenmessage-content").Render();
}
protected InnerUpdate(htmlElement: HTMLElement) {
super.InnerUpdate(htmlElement);
2021-01-07 03:50:12 +00:00
// This is a bit out of place, and it is a fix specifically for the featureinfobox-titlebar
const height = htmlElement.getElementsByClassName("featureinfobox-titlebar")[0]?.clientHeight ?? 0;
2021-01-07 03:50:12 +00:00
htmlElement.style.setProperty("--variable-title-height", height + "px")
}
}