2021-01-04 04:06:21 +01:00
|
|
|
import {UIElement} from "../UIElement";
|
|
|
|
import State from "../../State";
|
|
|
|
import BackgroundSelector from "./BackgroundSelector";
|
|
|
|
import LayerSelection from "./LayerSelection";
|
|
|
|
import Combine from "../Base/Combine";
|
2021-01-08 02:13:44 +01:00
|
|
|
import {FixedUiElement} from "../Base/FixedUiElement";
|
|
|
|
import ScrollableFullScreen from "../Base/ScrollableFullScreen";
|
2021-01-07 15:19:50 +01:00
|
|
|
import Translations from "../i18n/Translations";
|
2021-01-04 04:06:21 +01:00
|
|
|
|
2021-01-07 20:11:07 +01:00
|
|
|
export default class LayerControlPanel extends UIElement {
|
2021-01-04 04:06:21 +01:00
|
|
|
private readonly _panel: UIElement;
|
2021-01-07 20:11:07 +01:00
|
|
|
|
|
|
|
|
2021-01-22 00:40:15 +01:00
|
|
|
constructor(onClose: () => void) {
|
2021-01-04 04:06:21 +01:00
|
|
|
super();
|
2021-01-08 02:13:44 +01:00
|
|
|
let layerControlPanel: UIElement = new FixedUiElement("");
|
2021-01-04 04:06:21 +01:00
|
|
|
if (State.state.layoutToUse.data.enableBackgroundLayerSelection) {
|
|
|
|
layerControlPanel = new BackgroundSelector();
|
|
|
|
layerControlPanel.SetStyle("margin:1em");
|
|
|
|
layerControlPanel.onClick(() => {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (State.state.filteredLayers.data.length > 1) {
|
|
|
|
const layerSelection = new LayerSelection();
|
2021-01-07 20:11:07 +01:00
|
|
|
layerSelection.onClick(() => {
|
|
|
|
});
|
2021-01-04 04:06:21 +01:00
|
|
|
layerControlPanel = new Combine([layerSelection, "<br/>", layerControlPanel]);
|
|
|
|
}
|
2021-01-07 15:19:50 +01:00
|
|
|
|
|
|
|
|
2021-01-20 23:00:11 +01:00
|
|
|
const title = Translations.t.general.layerSelection.title.SetClass("text-2xl break-words font-bold p-2")
|
2021-01-07 15:19:50 +01:00
|
|
|
|
2021-01-22 00:40:15 +01:00
|
|
|
this._panel = new ScrollableFullScreen(title, layerControlPanel, () => {
|
|
|
|
onClose
|
|
|
|
});
|
2021-01-04 04:06:21 +01:00
|
|
|
}
|
2021-01-07 20:11:07 +01:00
|
|
|
|
2021-01-04 04:06:21 +01:00
|
|
|
InnerRender(): string {
|
|
|
|
return this._panel.Render();
|
|
|
|
}
|
2021-01-07 20:11:07 +01:00
|
|
|
|
2021-01-04 04:06:21 +01:00
|
|
|
}
|