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-02-25 02:23:26 +01:00
|
|
|
import {UIEventSource} from "../../Logic/UIEventSource";
|
2021-01-04 04:06:21 +01:00
|
|
|
|
2021-02-25 02:23:26 +01:00
|
|
|
export default class LayerControlPanel extends ScrollableFullScreen {
|
2021-01-07 20:11:07 +01:00
|
|
|
|
2021-02-25 02:23:26 +01:00
|
|
|
constructor(isShown: UIEventSource<boolean>) {
|
2021-03-12 14:52:34 +01:00
|
|
|
super(LayerControlPanel.GenTitle, LayerControlPanel.GeneratePanel, "layers", isShown);
|
2021-02-25 02:23:26 +01:00
|
|
|
}
|
2021-01-07 20:11:07 +01:00
|
|
|
|
2021-02-25 02:23:26 +01:00
|
|
|
private static GenTitle(): UIElement {
|
|
|
|
const title = Translations.t.general.layerSelection.title.SetClass("text-2xl break-words font-bold p-2")
|
|
|
|
return title.Clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static GeneratePanel() {
|
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) {
|
2021-02-20 01:45:51 +01:00
|
|
|
const layerSelection = new LayerSelection(State.state.filteredLayers);
|
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-02-25 02:23:26 +01:00
|
|
|
return layerControlPanel;
|
2021-01-04 04:06:21 +01:00
|
|
|
}
|
2021-01-07 20:11:07 +01:00
|
|
|
|
2021-01-04 04:06:21 +01:00
|
|
|
}
|