More UI tweaks, fix bugs with new icon handling

This commit is contained in:
Pieter Vander Vennet 2020-11-27 13:39:00 +01:00
parent 6299c8223e
commit 8383f482c7
9 changed files with 75 additions and 14 deletions

View file

@ -36,6 +36,7 @@ export class FeatureInfoBox extends UIElement {
layerConfig.titleIcons.map(icon => new TagRenderingAnswer(tags, icon)))
.SetClass("featureinfobox-icons");
this._renderings = layerConfig.tagRenderings.map(tr => new EditableTagRendering(tags, tr));
this._renderings[0]?.SetClass("first-rendering");
if (State.state.featureSwitchUserbadge.data) {
this._questionBox = new QuestionBox(tags, layerConfig.tagRenderings);
}

View file

@ -9,6 +9,7 @@ import State from "../State";
import {UIEventSource} from "../Logic/UIEventSource";
import Svg from "../Svg";
import {FixedUiElement} from "./Base/FixedUiElement";
/**
* Asks to add a feature at the last clicked location, at least if zoom is sufficient
@ -21,7 +22,7 @@ export class SimpleAddUI extends UIElement {
private _confirmPreset: UIEventSource<{
description: string | UIElement,
name: string | UIElement,
icon: string,
icon: UIElement,
tags: Tag[],
layerToAddTo: FilteredLayer
}>
@ -52,8 +53,8 @@ export class SimpleAddUI extends UIElement {
const presets = layer.layerDef.presets;
for (const preset of presets) {
let icon: string = layer.layerDef.icon.GetRenderValue(
TagUtils.KVtoProperties(preset.tags ?? [])).txt
const tags = TagUtils.KVtoProperties(preset.tags ?? []);
let icon: UIElement = new FixedUiElement(layer.layerDef.GenerateLeafletStyle(new UIEventSource<any>(tags), false).icon.html).SetClass("simple-add-ui-icon");
const csCount = State.state.osmConnection.userDetails.data.csCount;
let tagInfo = "";

View file

@ -58,7 +58,7 @@ export class SubstitutedTranslation extends UIElement {
for (const knownSpecial of SpecialVisualizations.specialVisualizations) {
// NOte: the '.*?' in the regex reads as 'any character, but in a non-greedy way'
// Note: the '.*?' in the regex reads as 'any character, but in a non-greedy way'
const matched = template.match(`(.*){${knownSpecial.funcName}\\((.*?)\\)}(.*)`);
if (matched != null) {