forked from MapComplete/MapComplete
Various bug fixes and updates
This commit is contained in:
parent
97ec893479
commit
e069b31e4e
29 changed files with 482 additions and 148 deletions
|
@ -10,6 +10,8 @@ import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
|||
import {MultiInput} from "../Input/MultiInput";
|
||||
import TagRenderingPanel from "./TagRenderingPanel";
|
||||
import SingleSetting from "./SingleSetting";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import {FromJSON} from "../../Customizations/JSON/FromJSON";
|
||||
|
||||
export default class AllLayersPanel extends UIElement {
|
||||
|
||||
|
@ -49,9 +51,22 @@ export default class AllLayersPanel extends UIElement {
|
|||
|
||||
const layers = this._config.data.layers;
|
||||
for (let i = 0; i < layers.length; i++) {
|
||||
|
||||
tabs.push({
|
||||
header: "<img src='./assets/bug.svg'>",
|
||||
header: new VariableUiElement(this._config.map((config: LayoutConfigJson) => {
|
||||
const layer = config.layers[i];
|
||||
if (typeof layer !== "string") {
|
||||
try {
|
||||
const iconTagRendering = FromJSON.TagRendering(layer.icon, "icon");
|
||||
const icon = iconTagRendering.GetContent({"id": "node/-1"}).txt;
|
||||
return `<img src='${icon}'>`
|
||||
} catch (e) {
|
||||
return "<img src='./assets/bug.svg'>"
|
||||
// Nothing to do here
|
||||
}
|
||||
}
|
||||
return "<img src='./assets/help.svg'>"
|
||||
|
||||
})),
|
||||
content: new LayerPanelWithPreview(this._config, this.languages, i, userDetails)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ export class GenerateEmpty {
|
|||
title: {},
|
||||
description: {},
|
||||
tagRenderings: [],
|
||||
hideUnderlayingFeaturesMinPercentage: 0,
|
||||
icon: {
|
||||
render: "./assets/bug.svg"
|
||||
},
|
||||
|
|
|
@ -96,7 +96,10 @@ export default class LayerPanel extends UIElement {
|
|||
{value: 2, shown: "Show both the ways/areas and the centerpoints"},
|
||||
{value: 1, shown: "Show everything as centerpoint"}]), "wayHandling", "Way handling",
|
||||
"Describes how ways and areas are represented on the map: areas can be represented as the area itself, or it can be converted into the centerpoint"),
|
||||
|
||||
setting(TextField.NumberInput("nat", n => n <= 100), "hideUnderlayingFeaturesMinPercentage", "Max allowed overlap percentage",
|
||||
"Consider that we want to show 'Nature Reserves' and 'Forests'. Now, ofter, there are pieces of forest mapped _in_ the nature reserve.<br/>" +
|
||||
"Now, showing those pieces of forest overlapping with the nature reserve truly clutters the map and is very user-unfriendly.<br/>" +
|
||||
"The features are placed layer by layer. If a feature below a feature on this layer overlaps for more then 'x'-percent, the underlying feature is hidden."),
|
||||
setting(new AndOrTagInput(), "overpassTags", "Overpass query",
|
||||
"The tags of the objects to load from overpass"),
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
|||
|
||||
export default class LayerPanelWithPreview extends UIElement{
|
||||
private panel: UIElement;
|
||||
|
||||
constructor(config: UIEventSource<any>, languages: UIEventSource<string[]>, index: number, userDetails: UserDetails) {
|
||||
super();
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
|
|||
|
||||
"<h3>Mappings</h3>",
|
||||
setting(new MultiInput<{ if: AndOrTagConfigJson, then: (string | any), hideInAnswer?: boolean }>("Add a mapping",
|
||||
() => ({if: undefined, then: undefined}),
|
||||
() => ({if: {and: []}, then: {}}),
|
||||
() => new MappingInput(languages, options?.disableQuestions ?? false),
|
||||
undefined, {allowMovement: true}), "mappings",
|
||||
"If a tag matches, then show the first respective text", "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue