forked from MapComplete/MapComplete
reset to previous commit
This commit is contained in:
parent
d5b614fc44
commit
196d40084d
90 changed files with 4953 additions and 1922 deletions
|
|
@ -10,6 +10,7 @@ import LayerConfig from "../../Customizations/JSON/LayerConfig";
|
|||
import BaseUIElement from "../BaseUIElement";
|
||||
import { Translation } from "../i18n/Translation";
|
||||
import ScrollableFullScreen from "../Base/ScrollableFullScreen";
|
||||
import Svg from "../../Svg";
|
||||
|
||||
/**
|
||||
* Shows the filter
|
||||
|
|
@ -26,14 +27,63 @@ export default class FilterView extends ScrollableFullScreen {
|
|||
}
|
||||
|
||||
private static Generatecontent(): BaseUIElement {
|
||||
let filterPanel: BaseUIElement = new FixedUiElement("more stuff");
|
||||
let filterPanel: BaseUIElement = new FixedUiElement("");
|
||||
|
||||
if (State.state.filteredLayers.data.length > 1) {
|
||||
let layers = State.state.filteredLayers;
|
||||
console.log(layers);
|
||||
filterPanel = new Combine(["layerssss", "<br/>", filterPanel]);
|
||||
}
|
||||
let activeLayers = State.state.filteredLayers;
|
||||
|
||||
return filterPanel;
|
||||
if (activeLayers === undefined) {
|
||||
throw "ActiveLayers should be defined...";
|
||||
}
|
||||
|
||||
const checkboxes: BaseUIElement[] = [];
|
||||
|
||||
for (const layer of activeLayers.data) {
|
||||
const iconStyle = "width:1.5rem;height:1.5rem;margin-left:1.25rem";
|
||||
|
||||
const icon = new Combine([Svg.checkbox_filled]).SetStyle(iconStyle);
|
||||
const iconUnselected = new Combine([Svg.checkbox_empty]).SetStyle(
|
||||
iconStyle
|
||||
);
|
||||
|
||||
if (layer.layerDef.name === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const style = "display:flex;align-items:center;color:#007759";
|
||||
|
||||
const name: Translation = Translations.WT(layer.layerDef.name)?.Clone();
|
||||
|
||||
const styledNameChecked = name
|
||||
.Clone()
|
||||
.SetStyle("font-size:large;padding-left:1.25rem");
|
||||
|
||||
const styledNameUnChecked = name
|
||||
.Clone()
|
||||
.SetStyle("font-size:large;padding-left:1.25rem");
|
||||
|
||||
const layerChecked = new Combine([icon, styledNameChecked]).SetStyle(
|
||||
style
|
||||
);
|
||||
|
||||
const layerNotChecked = new Combine([
|
||||
iconUnselected,
|
||||
styledNameUnChecked,
|
||||
]).SetStyle(style);
|
||||
|
||||
checkboxes.push(
|
||||
new Toggle(layerChecked, layerNotChecked, layer.isDisplayed)
|
||||
.ToggleOnClick()
|
||||
.SetStyle("margin:0.3em;")
|
||||
);
|
||||
}
|
||||
|
||||
let combinedCheckboxes = new Combine(checkboxes);
|
||||
combinedCheckboxes.SetStyle("display:flex;flex-direction:column;");
|
||||
|
||||
filterPanel = new Combine([combinedCheckboxes]);
|
||||
|
||||
return filterPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue