forked from MapComplete/MapComplete
Chore: reformat all files with prettier
This commit is contained in:
parent
5757ae5dea
commit
d008dcb54d
214 changed files with 8926 additions and 8196 deletions
|
@ -1,4 +1,4 @@
|
|||
import {Utils} from "../Utils"
|
||||
import { Utils } from "../Utils"
|
||||
import * as meta from "../package.json"
|
||||
|
||||
export type PriviligedLayerType = typeof Constants.priviliged_layers[number]
|
||||
|
@ -119,7 +119,19 @@ export default class Constants {
|
|||
/**
|
||||
* These are the values that are allowed to use as 'backdrop' icon for a map pin
|
||||
*/
|
||||
private static readonly _defaultPinIcons = ["square", "circle", "none", "pin", "person", "plus", "ring", "star", "teardrop", "triangle", "crosshair",] as const
|
||||
private static readonly _defaultPinIcons = [
|
||||
"square",
|
||||
"circle",
|
||||
"none",
|
||||
"pin",
|
||||
"person",
|
||||
"plus",
|
||||
"ring",
|
||||
"star",
|
||||
"teardrop",
|
||||
"triangle",
|
||||
"crosshair",
|
||||
] as const
|
||||
public static readonly defaultPinIcons: string[] = <any>Constants._defaultPinIcons
|
||||
|
||||
private static isRetina(): boolean {
|
||||
|
@ -131,8 +143,8 @@ export default class Constants {
|
|||
return (
|
||||
(window.matchMedia &&
|
||||
(window.matchMedia(
|
||||
"only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)"
|
||||
).matches ||
|
||||
"only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)"
|
||||
).matches ||
|
||||
window.matchMedia(
|
||||
"only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)"
|
||||
).matches)) ||
|
||||
|
|
|
@ -51,7 +51,6 @@ export class Denomination {
|
|||
return (this._humanSingular ?? this._human).Clone()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a representation of the given value
|
||||
* @param value: the value from OSM
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import LayerConfig from "./ThemeConfig/LayerConfig"
|
||||
import {UIEventSource} from "../Logic/UIEventSource"
|
||||
import { UIEventSource } from "../Logic/UIEventSource"
|
||||
import UserRelatedState from "../Logic/State/UserRelatedState"
|
||||
import {Utils} from "../Utils"
|
||||
import {LocalStorageSource} from "../Logic/Web/LocalStorageSource"
|
||||
import { Utils } from "../Utils"
|
||||
import { LocalStorageSource } from "../Logic/Web/LocalStorageSource"
|
||||
|
||||
export type ThemeViewTabStates = typeof MenuState._themeviewTabs[number]
|
||||
export type MenuViewTabStates = typeof MenuState._menuviewTabs[number]
|
||||
|
@ -14,8 +14,20 @@ export type MenuViewTabStates = typeof MenuState._menuviewTabs[number]
|
|||
* Some convenience methods are provided for this as well
|
||||
*/
|
||||
export class MenuState {
|
||||
public static readonly _themeviewTabs = ["intro", "filters", "download", "copyright","share"] as const
|
||||
public static readonly _menuviewTabs = ["about", "settings", "community", "privacy","advanced"] as const
|
||||
public static readonly _themeviewTabs = [
|
||||
"intro",
|
||||
"filters",
|
||||
"download",
|
||||
"copyright",
|
||||
"share",
|
||||
] as const
|
||||
public static readonly _menuviewTabs = [
|
||||
"about",
|
||||
"settings",
|
||||
"community",
|
||||
"privacy",
|
||||
"advanced",
|
||||
] as const
|
||||
public readonly themeIsOpened: UIEventSource<boolean>
|
||||
public readonly themeViewTabIndex: UIEventSource<number>
|
||||
public readonly themeViewTab: UIEventSource<ThemeViewTabStates>
|
||||
|
@ -23,11 +35,13 @@ export class MenuState {
|
|||
public readonly menuViewTabIndex: UIEventSource<number>
|
||||
public readonly menuViewTab: UIEventSource<MenuViewTabStates>
|
||||
|
||||
public readonly backgroundLayerSelectionIsOpened: UIEventSource<boolean> = new UIEventSource<boolean>(false)
|
||||
public readonly backgroundLayerSelectionIsOpened: UIEventSource<boolean> =
|
||||
new UIEventSource<boolean>(false)
|
||||
|
||||
public readonly allToggles: {
|
||||
toggle: UIEventSource<boolean>, name: string,
|
||||
submenu?: UIEventSource<string>,
|
||||
toggle: UIEventSource<boolean>
|
||||
name: string
|
||||
submenu?: UIEventSource<string>
|
||||
showOverOthers?: boolean
|
||||
}[]
|
||||
|
||||
|
@ -81,16 +95,19 @@ export class MenuState {
|
|||
{
|
||||
toggle: this.menuIsOpened,
|
||||
name: "menu",
|
||||
submenu: this.menuViewTab
|
||||
}, {
|
||||
submenu: this.menuViewTab,
|
||||
},
|
||||
{
|
||||
toggle: this.themeIsOpened,
|
||||
name: "theme-menu",
|
||||
submenu: this.themeViewTab
|
||||
}, {
|
||||
submenu: this.themeViewTab,
|
||||
},
|
||||
{
|
||||
toggle: this.backgroundLayerSelectionIsOpened,
|
||||
name: "background",
|
||||
showOverOthers: true
|
||||
}]
|
||||
showOverOthers: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
public openFilterView(highlightLayer?: LayerConfig | string) {
|
||||
|
@ -128,10 +145,13 @@ export class MenuState {
|
|||
* Returns 'true' if at least one menu was opened
|
||||
*/
|
||||
public closeAll(): boolean {
|
||||
const toggles = [this.menuIsOpened, this.themeIsOpened, this.backgroundLayerSelectionIsOpened]
|
||||
const somethingIsOpen = toggles.some(t => t.data)
|
||||
toggles.forEach(t => t.setData(false))
|
||||
const toggles = [
|
||||
this.menuIsOpened,
|
||||
this.themeIsOpened,
|
||||
this.backgroundLayerSelectionIsOpened,
|
||||
]
|
||||
const somethingIsOpen = toggles.some((t) => t.data)
|
||||
toggles.forEach((t) => t.setData(false))
|
||||
return somethingIsOpen
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Feature, Polygon} from "geojson"
|
||||
import { Feature, Polygon } from "geojson"
|
||||
import * as editorlayerindex from "../assets/editor-layer-index.json"
|
||||
import * as globallayers from "../assets/global-raster-layers.json"
|
||||
import {BBox} from "../Logic/BBox"
|
||||
import {Store, Stores} from "../Logic/UIEventSource"
|
||||
import {GeoOperations} from "../Logic/GeoOperations"
|
||||
import {RasterLayerProperties} from "./RasterLayerProperties"
|
||||
import { BBox } from "../Logic/BBox"
|
||||
import { Store, Stores } from "../Logic/UIEventSource"
|
||||
import { GeoOperations } from "../Logic/GeoOperations"
|
||||
import { RasterLayerProperties } from "./RasterLayerProperties"
|
||||
|
||||
export class AvailableRasterLayers {
|
||||
public static EditorLayerIndex: (Feature<Polygon, EditorLayerIndexProperties> &
|
||||
|
@ -47,8 +47,8 @@ export class AvailableRasterLayers {
|
|||
type: "vector",
|
||||
attribution: {
|
||||
text: "Maptiler",
|
||||
url: "https://www.maptiler.com/copyright/"
|
||||
}
|
||||
url: "https://www.maptiler.com/copyright/",
|
||||
},
|
||||
},
|
||||
geometry: BBox.global.asGeometry(),
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ export class AvailableRasterLayers {
|
|||
type: "vector",
|
||||
attribution: {
|
||||
text: "Americana",
|
||||
url: "https://github.com/ZeLonewolf/openstreetmap-americana/"
|
||||
}
|
||||
url: "https://github.com/ZeLonewolf/openstreetmap-americana/",
|
||||
},
|
||||
},
|
||||
geometry: BBox.global.asGeometry(),
|
||||
}
|
||||
|
@ -151,7 +151,14 @@ export interface EditorLayerIndexProperties extends RasterLayerProperties {
|
|||
* Whether the imagery name should be translated
|
||||
*/
|
||||
readonly i18n?: boolean
|
||||
readonly type: "tms" | "wms" | "bing" | "scanex" | "wms_endpoint" | "wmts" | "vector" /* Vector is not actually part of the ELI-spec, we add it for vector layers */
|
||||
readonly type:
|
||||
| "tms"
|
||||
| "wms"
|
||||
| "bing"
|
||||
| "scanex"
|
||||
| "wms_endpoint"
|
||||
| "wmts"
|
||||
| "vector" /* Vector is not actually part of the ELI-spec, we add it for vector layers */
|
||||
/**
|
||||
* A rough categorisation of different types of layers. See https://github.com/osmlab/editor-layer-index/blob/gh-pages/CONTRIBUTING.md#categories for a description of the individual categories.
|
||||
*/
|
||||
|
|
|
@ -297,8 +297,8 @@ export class Fuse<T> extends DesugaringStep<T> {
|
|||
const step = this.steps[i]
|
||||
try {
|
||||
let r = step.convert(json, "While running step " + step.name + ": " + context)
|
||||
if(r.result["tagRenderings"]?.some(tr => tr === undefined)){
|
||||
throw step.name+" introduced an undefined tagRendering"
|
||||
if (r.result["tagRenderings"]?.some((tr) => tr === undefined)) {
|
||||
throw step.name + " introduced an undefined tagRendering"
|
||||
}
|
||||
errors.push(...(r.errors ?? []))
|
||||
warnings.push(...(r.warnings ?? []))
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {Conversion} from "./Conversion"
|
||||
import { Conversion } from "./Conversion"
|
||||
import LayerConfig from "../LayerConfig"
|
||||
import {LayerConfigJson} from "../Json/LayerConfigJson"
|
||||
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
||||
import Translations from "../../../UI/i18n/Translations"
|
||||
import PointRenderingConfigJson from "../Json/PointRenderingConfigJson"
|
||||
import {Translation, TypedTranslation} from "../../../UI/i18n/Translation"
|
||||
import { Translation, TypedTranslation } from "../../../UI/i18n/Translation"
|
||||
|
||||
export default class CreateNoteImportLayer extends Conversion<LayerConfigJson, LayerConfigJson> {
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ export default class CreateNoteImportLayer extends Conversion<LayerConfigJson, L
|
|||
geoJsonZoomLevel: 10,
|
||||
maxCacheAge: 0,
|
||||
},
|
||||
/* We need to set 'pass_all_features'
|
||||
/* We need to set 'pass_all_features'
|
||||
There are probably many note_import-layers, and we don't want the first one to gobble up all notes and then discard them...
|
||||
*/
|
||||
passAllFeatures: true,
|
||||
|
@ -175,7 +175,7 @@ export default class CreateNoteImportLayer extends Conversion<LayerConfigJson, L
|
|||
render: tr(t.nearbyImagesIntro),
|
||||
},
|
||||
{
|
||||
id:"all_tags",
|
||||
id: "all_tags",
|
||||
render: "{all_tags()}",
|
||||
metacondition: {
|
||||
or: [
|
||||
|
@ -184,7 +184,7 @@ export default class CreateNoteImportLayer extends Conversion<LayerConfigJson, L
|
|||
"mapcomplete-show_debug=yes",
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
mapRendering: [
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@ import { TagConfigJson } from "../Json/TagConfigJson"
|
|||
import PointRenderingConfigJson from "../Json/PointRenderingConfigJson"
|
||||
import LineRenderingConfigJson from "../Json/LineRenderingConfigJson"
|
||||
import ValidationUtils from "./ValidationUtils"
|
||||
import {RenderingSpecification} from "../../../UI/SpecialVisualization"
|
||||
import {QuestionableTagRenderingConfigJson} from "../Json/QuestionableTagRenderingConfigJson"
|
||||
import { RenderingSpecification } from "../../../UI/SpecialVisualization"
|
||||
import { QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson"
|
||||
|
||||
class ExpandFilter extends DesugaringStep<LayerConfigJson> {
|
||||
private static readonly predefinedFilters = ExpandFilter.load_filters()
|
||||
|
@ -446,11 +446,11 @@ class DetectInline extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
|||
information?: string[]
|
||||
} {
|
||||
if (json.freeform === undefined) {
|
||||
return {result: json}
|
||||
return { result: json }
|
||||
}
|
||||
let spec: Record<string, string>
|
||||
if (typeof json.render === "string") {
|
||||
spec = {"*": json.render}
|
||||
spec = { "*": json.render }
|
||||
} else {
|
||||
spec = <Record<string, string>>json.render
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ class DetectInline extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
|||
if (spec[key].indexOf("<a ") >= 0) {
|
||||
// We have a link element, it probably contains something that needs to be substituted...
|
||||
// Let's play this safe and not inline it
|
||||
return {result: json}
|
||||
return { result: json }
|
||||
}
|
||||
const fullSpecification = SpecialVisualizations.constructSpecification(spec[key])
|
||||
if (fullSpecification.length > 1) {
|
||||
|
@ -467,19 +467,19 @@ class DetectInline extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
|||
if (json.freeform.inline === true) {
|
||||
errors.push(
|
||||
"At " +
|
||||
context +
|
||||
": 'inline' is set, but the rendering contains a special visualisation...\n " +
|
||||
spec[key]
|
||||
context +
|
||||
": 'inline' is set, but the rendering contains a special visualisation...\n " +
|
||||
spec[key]
|
||||
)
|
||||
}
|
||||
json = JSON.parse(JSON.stringify(json))
|
||||
json.freeform.inline = false
|
||||
return {result: json, errors}
|
||||
return { result: json, errors }
|
||||
}
|
||||
}
|
||||
json = JSON.parse(JSON.stringify(json))
|
||||
json.freeform.inline ??= true
|
||||
return {result: json, errors}
|
||||
return { result: json, errors }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
|
|||
json.tagRenderings === undefined ||
|
||||
json.tagRenderings.some((tr) => tr["id"] === "leftover-questions")
|
||||
) {
|
||||
return {result: json}
|
||||
return { result: json }
|
||||
}
|
||||
json = JSON.parse(JSON.stringify(json))
|
||||
const allSpecials: Exclude<RenderingSpecification, string>[] = []
|
||||
|
@ -521,8 +521,8 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
|
|||
if (noLabels.length > 1) {
|
||||
errors.push(
|
||||
"At " +
|
||||
context +
|
||||
": multiple 'questions'-visualisations found which would show _all_ questions. Don't do this"
|
||||
context +
|
||||
": multiple 'questions'-visualisations found which would show _all_ questions. Don't do this"
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -546,24 +546,24 @@ export class AddQuestionBox extends DesugaringStep<LayerConfigJson> {
|
|||
if (blacklisted?.length > 0 && used?.length > 0) {
|
||||
errors.push(
|
||||
"At " +
|
||||
context +
|
||||
": the {questions()}-special rendering only supports either a blacklist OR a whitelist, but not both." +
|
||||
"\n Whitelisted: " +
|
||||
used.join(", ") +
|
||||
"\n Blacklisted: " +
|
||||
blacklisted.join(", ")
|
||||
context +
|
||||
": the {questions()}-special rendering only supports either a blacklist OR a whitelist, but not both." +
|
||||
"\n Whitelisted: " +
|
||||
used.join(", ") +
|
||||
"\n Blacklisted: " +
|
||||
blacklisted.join(", ")
|
||||
)
|
||||
}
|
||||
for (const usedLabel of used) {
|
||||
if (!allLabels.has(usedLabel)) {
|
||||
errors.push(
|
||||
"At " +
|
||||
context +
|
||||
": this layers specifies a special question element for label `" +
|
||||
usedLabel +
|
||||
"`, but this label doesn't exist.\n" +
|
||||
" Available labels are " +
|
||||
Array.from(allLabels).join(", ")
|
||||
context +
|
||||
": this layers specifies a special question element for label `" +
|
||||
usedLabel +
|
||||
"`, but this label doesn't exist.\n" +
|
||||
" Available labels are " +
|
||||
Array.from(allLabels).join(", ")
|
||||
)
|
||||
}
|
||||
seen.add(usedLabel)
|
||||
|
@ -619,7 +619,7 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
if (json.allowSplit && !ValidationUtils.hasSpecialVisualisation(json, "split_button")) {
|
||||
json.tagRenderings.push({
|
||||
id: "split-button",
|
||||
render: {"*": "{split_button()}"},
|
||||
render: { "*": "{split_button()}" },
|
||||
})
|
||||
delete json.allowSplit
|
||||
}
|
||||
|
@ -627,13 +627,13 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
if (json.allowMove && !ValidationUtils.hasSpecialVisualisation(json, "move_button")) {
|
||||
json.tagRenderings.push({
|
||||
id: "move-button",
|
||||
render: {"*": "{move_button()}"},
|
||||
render: { "*": "{move_button()}" },
|
||||
})
|
||||
}
|
||||
if (json.deletion && !ValidationUtils.hasSpecialVisualisation(json, "delete_button")) {
|
||||
json.tagRenderings.push({
|
||||
id: "delete-button",
|
||||
render: {"*": "{delete_button()}"},
|
||||
render: { "*": "{delete_button()}" },
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
if (!ValidationUtils.hasSpecialVisualisation(json, "all_tags")) {
|
||||
const trc: TagRenderingConfigJson = {
|
||||
id: "all-tags",
|
||||
render: {"*": "{all_tags()}"},
|
||||
render: { "*": "{all_tags()}" },
|
||||
|
||||
metacondition: {
|
||||
or: [
|
||||
|
@ -663,7 +663,7 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
|
|||
json.tagRenderings?.push(trc)
|
||||
}
|
||||
|
||||
return {result: json}
|
||||
return { result: json }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1161,31 +1161,37 @@ class PreparePointRendering extends Fuse<PointRenderingConfigJson | LineRenderin
|
|||
|
||||
class SetFullNodeDatabase extends DesugaringStep<LayerConfigJson> {
|
||||
constructor() {
|
||||
super("sets the fullNodeDatabase-bit if needed",
|
||||
super(
|
||||
"sets the fullNodeDatabase-bit if needed",
|
||||
["fullNodeDatabase"],
|
||||
"SetFullNodeDatabase")
|
||||
"SetFullNodeDatabase"
|
||||
)
|
||||
}
|
||||
|
||||
convert(json: LayerConfigJson, context: string): {
|
||||
result: LayerConfigJson;
|
||||
errors?: string[];
|
||||
warnings?: string[];
|
||||
convert(
|
||||
json: LayerConfigJson,
|
||||
context: string
|
||||
): {
|
||||
result: LayerConfigJson
|
||||
errors?: string[]
|
||||
warnings?: string[]
|
||||
information?: string[]
|
||||
} {
|
||||
const needsSpecial = json.tagRenderings?.some(tr => {
|
||||
if (typeof tr === "string") {
|
||||
return false
|
||||
}
|
||||
const specs = ValidationUtils.getSpecialVisualisations(<TagRenderingConfigJson>tr)
|
||||
return specs?.some(sp => sp.needsNodeDatabase)
|
||||
}) ?? false
|
||||
const needsSpecial =
|
||||
json.tagRenderings?.some((tr) => {
|
||||
if (typeof tr === "string") {
|
||||
return false
|
||||
}
|
||||
const specs = ValidationUtils.getSpecialVisualisations(<TagRenderingConfigJson>tr)
|
||||
return specs?.some((sp) => sp.needsNodeDatabase)
|
||||
}) ?? false
|
||||
if (!needsSpecial) {
|
||||
return {result: json}
|
||||
return { result: json }
|
||||
}
|
||||
return {
|
||||
result: {...json, fullNodeDatabase: true},
|
||||
information: ["Layer " + json.id + " needs the fullNodeDatabase"]
|
||||
};
|
||||
result: { ...json, fullNodeDatabase: true },
|
||||
information: ["Layer " + json.id + " needs the fullNodeDatabase"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1203,12 +1209,12 @@ export class AddMiniMap extends DesugaringStep<LayerConfigJson> {
|
|||
|
||||
convert(layerConfig: LayerConfigJson, context: string): { result: LayerConfigJson } {
|
||||
if (!layerConfig.tagRenderings || layerConfig.source === "special") {
|
||||
return {result: layerConfig}
|
||||
return { result: layerConfig }
|
||||
}
|
||||
const state = this._state
|
||||
const hasMinimap = ValidationUtils.hasSpecialVisualisation(layerConfig, "minimap")
|
||||
if (!hasMinimap) {
|
||||
layerConfig = {...layerConfig}
|
||||
layerConfig = { ...layerConfig }
|
||||
layerConfig.tagRenderings = [...layerConfig.tagRenderings]
|
||||
const minimap = state.tagRenderings.get("minimap")
|
||||
if (minimap === undefined) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {TagRenderingConfigJson} from "../Json/TagRenderingConfigJson"
|
||||
import {Utils} from "../../../Utils"
|
||||
import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
|
||||
import { Utils } from "../../../Utils"
|
||||
import SpecialVisualizations from "../../../UI/SpecialVisualizations"
|
||||
import {RenderingSpecification, SpecialVisualization} from "../../../UI/SpecialVisualization"
|
||||
import {LayerConfigJson} from "../Json/LayerConfigJson"
|
||||
import { RenderingSpecification, SpecialVisualization } from "../../../UI/SpecialVisualization"
|
||||
import { LayerConfigJson } from "../Json/LayerConfigJson"
|
||||
|
||||
export default class ValidationUtils {
|
||||
public static hasSpecialVisualisation(
|
||||
|
@ -11,14 +11,15 @@ export default class ValidationUtils {
|
|||
): boolean {
|
||||
return (
|
||||
layer.tagRenderings?.some((tagRendering) => {
|
||||
if(tagRendering === undefined){
|
||||
return false
|
||||
}
|
||||
|
||||
const spec = ValidationUtils.getSpecialVisualisations(<TagRenderingConfigJson>tagRendering)
|
||||
return spec.some((vis) => vis.funcName === specialVisualisation);
|
||||
if (tagRendering === undefined) {
|
||||
return false
|
||||
}
|
||||
) ?? false
|
||||
|
||||
const spec = ValidationUtils.getSpecialVisualisations(
|
||||
<TagRenderingConfigJson>tagRendering
|
||||
)
|
||||
return spec.some((vis) => vis.funcName === specialVisualisation)
|
||||
}) ?? false
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,7 @@ export default class ValidationUtils {
|
|||
const all: RenderingSpecification[] = []
|
||||
for (let translation of translations) {
|
||||
if (typeof translation == "string") {
|
||||
translation = {"*": translation}
|
||||
translation = { "*": translation }
|
||||
}
|
||||
|
||||
for (const key in translation) {
|
||||
|
|
|
@ -3,9 +3,9 @@ import { TagsFilter } from "../../Logic/Tags/TagsFilter"
|
|||
import { DeleteConfigJson } from "./Json/DeleteConfigJson"
|
||||
import Translations from "../../UI/i18n/Translations"
|
||||
import { TagUtils } from "../../Logic/Tags/TagUtils"
|
||||
import TagRenderingConfig from "./TagRenderingConfig";
|
||||
import {QuestionableTagRenderingConfigJson} from "./Json/QuestionableTagRenderingConfigJson";
|
||||
import {TagConfigJson} from "./Json/TagConfigJson";
|
||||
import TagRenderingConfig from "./TagRenderingConfig"
|
||||
import { QuestionableTagRenderingConfigJson } from "./Json/QuestionableTagRenderingConfigJson"
|
||||
import { TagConfigJson } from "./Json/TagConfigJson"
|
||||
|
||||
export default class DeleteConfig {
|
||||
public static readonly deleteReasonKey = "_delete_reason"
|
||||
|
@ -97,24 +97,24 @@ export default class DeleteConfig {
|
|||
public constructTagRendering(): TagRenderingConfig {
|
||||
const t = Translations.t.delete
|
||||
|
||||
const mappings: {if: TagConfigJson, then: Record<string, string>} []= []
|
||||
const mappings: { if: TagConfigJson; then: Record<string, string> }[] = []
|
||||
for (const nonDeleteMapping of this.nonDeleteMappings) {
|
||||
mappings.push({
|
||||
if: nonDeleteMapping.if,
|
||||
then: nonDeleteMapping.then.translations
|
||||
then: nonDeleteMapping.then.translations,
|
||||
})
|
||||
}
|
||||
|
||||
for (const deleteReason of this.deleteReasons) {
|
||||
mappings.push({
|
||||
if: DeleteConfig.deleteReasonKey+ "="+ deleteReason.changesetMessage,
|
||||
then: deleteReason.explanation.translations
|
||||
if: DeleteConfig.deleteReasonKey + "=" + deleteReason.changesetMessage,
|
||||
then: deleteReason.explanation.translations,
|
||||
})
|
||||
}
|
||||
|
||||
const config: QuestionableTagRenderingConfigJson = {
|
||||
question: t.whyDelete.translations,
|
||||
mappings
|
||||
mappings,
|
||||
}
|
||||
return new TagRenderingConfig(config)
|
||||
}
|
||||
|
|
|
@ -103,7 +103,11 @@ export default class DependencyCalculator {
|
|||
currentLine = i // Leak the state...
|
||||
currentKey = key
|
||||
try {
|
||||
const func = new Function("feat", "{"+ExtraFunctions.types.join(",")+"}", "return " + code + ";")
|
||||
const func = new Function(
|
||||
"feat",
|
||||
"{" + ExtraFunctions.types.join(",") + "}",
|
||||
"return " + code + ";"
|
||||
)
|
||||
const result = func(obj, helpers)
|
||||
obj.properties[key] = JSON.stringify(result)
|
||||
} catch (e) {}
|
||||
|
|
|
@ -31,7 +31,6 @@ export default interface LineRenderingConfigJson {
|
|||
*/
|
||||
lineCap?: "round" | "square" | "butt" | string | TagRenderingConfigJson
|
||||
|
||||
|
||||
/**
|
||||
* The color to fill a polygon with.
|
||||
* If undefined, this will be slightly more opaque version of the stroke line.
|
||||
|
|
|
@ -417,7 +417,6 @@ export default class LayerConfig extends WithContextLoader {
|
|||
)
|
||||
}
|
||||
this.popupInFloatover = json.popupInFloatover ?? false
|
||||
|
||||
}
|
||||
|
||||
public defaultIcon(): BaseUIElement | undefined {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import PointRenderingConfigJson from "./Json/PointRenderingConfigJson"
|
||||
import TagRenderingConfig from "./TagRenderingConfig"
|
||||
import {TagsFilter} from "../../Logic/Tags/TagsFilter"
|
||||
import {TagUtils} from "../../Logic/Tags/TagUtils"
|
||||
import {Utils} from "../../Utils"
|
||||
import { TagsFilter } from "../../Logic/Tags/TagsFilter"
|
||||
import { TagUtils } from "../../Logic/Tags/TagUtils"
|
||||
import { Utils } from "../../Utils"
|
||||
import Svg from "../../Svg"
|
||||
import WithContextLoader from "./WithContextLoader"
|
||||
import {Store} from "../../Logic/UIEventSource"
|
||||
import { Store } from "../../Logic/UIEventSource"
|
||||
import BaseUIElement from "../../UI/BaseUIElement"
|
||||
import {FixedUiElement} from "../../UI/Base/FixedUiElement"
|
||||
import { FixedUiElement } from "../../UI/Base/FixedUiElement"
|
||||
import Img from "../../UI/Base/Img"
|
||||
import Combine from "../../UI/Base/Combine"
|
||||
import {VariableUiElement} from "../../UI/Base/VariableUIElement"
|
||||
import { VariableUiElement } from "../../UI/Base/VariableUIElement"
|
||||
|
||||
export default class PointRenderingConfig extends WithContextLoader {
|
||||
static readonly allowed_location_codes: ReadonlySet<string> = new Set<string>([
|
||||
|
@ -83,7 +83,7 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
}
|
||||
})
|
||||
|
||||
const iconPath = this.icon?.GetRenderValue({id: "node/-1"})?.txt
|
||||
const iconPath = this.icon?.GetRenderValue({ id: "node/-1" })?.txt
|
||||
if (iconPath !== undefined && iconPath.startsWith(Utils.assets_path)) {
|
||||
const iconKey = iconPath.substr(Utils.assets_path.length)
|
||||
if (Svg.All[iconKey] === undefined) {
|
||||
|
@ -168,7 +168,7 @@ export default class PointRenderingConfig extends WithContextLoader {
|
|||
noFullWidth?: boolean
|
||||
}
|
||||
): BaseUIElement {
|
||||
tags = tags ?? {id: "node/-1"}
|
||||
tags = tags ?? { id: "node/-1" }
|
||||
let defaultPin: BaseUIElement = undefined
|
||||
if (this.label === undefined) {
|
||||
defaultPin = Svg.teardrop_with_hole_green_svg()
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
import {Translation, TypedTranslation} from "../../UI/i18n/Translation"
|
||||
import {TagsFilter} from "../../Logic/Tags/TagsFilter"
|
||||
import { Translation, TypedTranslation } from "../../UI/i18n/Translation"
|
||||
import { TagsFilter } from "../../Logic/Tags/TagsFilter"
|
||||
import Translations from "../../UI/i18n/Translations"
|
||||
import {TagUtils, UploadableTag} from "../../Logic/Tags/TagUtils"
|
||||
import {And} from "../../Logic/Tags/And"
|
||||
import {Utils} from "../../Utils"
|
||||
import {Tag} from "../../Logic/Tags/Tag"
|
||||
import { TagUtils, UploadableTag } from "../../Logic/Tags/TagUtils"
|
||||
import { And } from "../../Logic/Tags/And"
|
||||
import { Utils } from "../../Utils"
|
||||
import { Tag } from "../../Logic/Tags/Tag"
|
||||
import BaseUIElement from "../../UI/BaseUIElement"
|
||||
import Combine from "../../UI/Base/Combine"
|
||||
import Title from "../../UI/Base/Title"
|
||||
import Link from "../../UI/Base/Link"
|
||||
import List from "../../UI/Base/List"
|
||||
import {MappingConfigJson, QuestionableTagRenderingConfigJson,} from "./Json/QuestionableTagRenderingConfigJson"
|
||||
import {FixedUiElement} from "../../UI/Base/FixedUiElement"
|
||||
import {Paragraph} from "../../UI/Base/Paragraph"
|
||||
import {
|
||||
MappingConfigJson,
|
||||
QuestionableTagRenderingConfigJson,
|
||||
} from "./Json/QuestionableTagRenderingConfigJson"
|
||||
import { FixedUiElement } from "../../UI/Base/FixedUiElement"
|
||||
import { Paragraph } from "../../UI/Base/Paragraph"
|
||||
import Svg from "../../Svg"
|
||||
import Validators, {ValidatorType} from "../../UI/InputElement/Validators";
|
||||
import Validators, { ValidatorType } from "../../UI/InputElement/Validators"
|
||||
|
||||
export interface Mapping {
|
||||
readonly if: UploadableTag
|
||||
|
@ -118,9 +121,9 @@ export default class TagRenderingConfig {
|
|||
this.question = Translations.T(json.question, translationKey + ".question")
|
||||
this.questionhint = Translations.T(json.questionHint, translationKey + ".questionHint")
|
||||
this.description = Translations.T(json.description, translationKey + ".description")
|
||||
this.condition = TagUtils.Tag(json.condition ?? {and: []}, `${context}.condition`)
|
||||
this.condition = TagUtils.Tag(json.condition ?? { and: [] }, `${context}.condition`)
|
||||
this.metacondition = TagUtils.Tag(
|
||||
json.metacondition ?? {and: []},
|
||||
json.metacondition ?? { and: [] },
|
||||
`${context}.metacondition`
|
||||
)
|
||||
if (json.freeform) {
|
||||
|
@ -537,11 +540,8 @@ export default class TagRenderingConfig {
|
|||
}
|
||||
}
|
||||
|
||||
if (
|
||||
this.freeform?.key === undefined ||
|
||||
tags[this.freeform.key] !== undefined
|
||||
) {
|
||||
return {then: this.render}
|
||||
if (this.freeform?.key === undefined || tags[this.freeform.key] !== undefined) {
|
||||
return { then: this.render }
|
||||
}
|
||||
|
||||
return undefined
|
||||
|
@ -681,13 +681,13 @@ export default class TagRenderingConfig {
|
|||
)
|
||||
}
|
||||
const and = TagUtils.FlattenMultiAnswer([...selectedMappings, ...unselectedMappings])
|
||||
if(and.and.length === 0){
|
||||
if (and.and.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
return and
|
||||
} else {
|
||||
// Is at least one mapping shown in the answer?
|
||||
const someMappingIsShown = this.mappings.some(m => {
|
||||
const someMappingIsShown = this.mappings.some((m) => {
|
||||
if (typeof m.hideInAnswer === "boolean") {
|
||||
return !m.hideInAnswer
|
||||
}
|
||||
|
@ -695,7 +695,9 @@ export default class TagRenderingConfig {
|
|||
return !isHidden
|
||||
})
|
||||
// If all mappings are hidden for the current tags, we can safely assume that we should use the freeform key
|
||||
const useFreeform = freeformValue !== undefined && (singleSelectedMapping === this.mappings.length || !someMappingIsShown)
|
||||
const useFreeform =
|
||||
freeformValue !== undefined &&
|
||||
(singleSelectedMapping === this.mappings.length || !someMappingIsShown)
|
||||
if (useFreeform) {
|
||||
return new And([
|
||||
new Tag(this.freeform.key, freeformValue),
|
||||
|
@ -711,7 +713,7 @@ export default class TagRenderingConfig {
|
|||
freeformValue,
|
||||
singleSelectedMapping,
|
||||
multiSelectedMapping,
|
||||
currentProperties
|
||||
currentProperties,
|
||||
})
|
||||
return undefined
|
||||
}
|
||||
|
@ -757,7 +759,7 @@ export default class TagRenderingConfig {
|
|||
if (m.ifnot !== undefined) {
|
||||
msgs.push(
|
||||
"Unselecting this answer will add " +
|
||||
m.ifnot.asHumanString(true, false, {})
|
||||
m.ifnot.asHumanString(true, false, {})
|
||||
)
|
||||
}
|
||||
return msgs
|
||||
|
@ -787,12 +789,12 @@ export default class TagRenderingConfig {
|
|||
this.description,
|
||||
this.question !== undefined
|
||||
? new Combine([
|
||||
"The question is ",
|
||||
new FixedUiElement(this.question.txt).SetClass("font-bold bold"),
|
||||
])
|
||||
"The question is ",
|
||||
new FixedUiElement(this.question.txt).SetClass("font-bold bold"),
|
||||
])
|
||||
: new FixedUiElement(
|
||||
"This tagrendering has no question and is thus read-only"
|
||||
).SetClass("italic"),
|
||||
"This tagrendering has no question and is thus read-only"
|
||||
).SetClass("italic"),
|
||||
new Combine(withRender),
|
||||
mappings,
|
||||
condition,
|
||||
|
|
|
@ -21,7 +21,10 @@ export default class WithContextLoader {
|
|||
if (deflt === undefined) {
|
||||
return undefined
|
||||
}
|
||||
return new TagRenderingConfig(deflt, `${translationContext ?? this._context}.${key}.default value`)
|
||||
return new TagRenderingConfig(
|
||||
deflt,
|
||||
`${translationContext ?? this._context}.${key}.default value`
|
||||
)
|
||||
}
|
||||
if (typeof v === "string") {
|
||||
const shared = SharedTagRenderings.SharedTagRendering.get(v)
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
import LayoutConfig from "./ThemeConfig/LayoutConfig"
|
||||
import {SpecialVisualizationState} from "../UI/SpecialVisualization"
|
||||
import {Changes} from "../Logic/Osm/Changes"
|
||||
import {ImmutableStore, Store, UIEventSource} from "../Logic/UIEventSource"
|
||||
import {FeatureSource, IndexedFeatureSource, WritableFeatureSource,} from "../Logic/FeatureSource/FeatureSource"
|
||||
import {OsmConnection} from "../Logic/Osm/OsmConnection"
|
||||
import {ExportableMap, MapProperties} from "./MapProperties"
|
||||
import { SpecialVisualizationState } from "../UI/SpecialVisualization"
|
||||
import { Changes } from "../Logic/Osm/Changes"
|
||||
import { ImmutableStore, Store, UIEventSource } from "../Logic/UIEventSource"
|
||||
import {
|
||||
FeatureSource,
|
||||
IndexedFeatureSource,
|
||||
WritableFeatureSource,
|
||||
} from "../Logic/FeatureSource/FeatureSource"
|
||||
import { OsmConnection } from "../Logic/Osm/OsmConnection"
|
||||
import { ExportableMap, MapProperties } from "./MapProperties"
|
||||
import LayerState from "../Logic/State/LayerState"
|
||||
import {Feature, Point, Polygon} from "geojson"
|
||||
import { Feature, Point, Polygon } from "geojson"
|
||||
import FullNodeDatabaseSource from "../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"
|
||||
import {Map as MlMap} from "maplibre-gl"
|
||||
import { Map as MlMap } from "maplibre-gl"
|
||||
import InitialMapPositioning from "../Logic/Actors/InitialMapPositioning"
|
||||
import {MapLibreAdaptor} from "../UI/Map/MapLibreAdaptor"
|
||||
import {GeoLocationState} from "../Logic/State/GeoLocationState"
|
||||
import { MapLibreAdaptor } from "../UI/Map/MapLibreAdaptor"
|
||||
import { GeoLocationState } from "../Logic/State/GeoLocationState"
|
||||
import FeatureSwitchState from "../Logic/State/FeatureSwitchState"
|
||||
import {QueryParameters} from "../Logic/Web/QueryParameters"
|
||||
import { QueryParameters } from "../Logic/Web/QueryParameters"
|
||||
import UserRelatedState from "../Logic/State/UserRelatedState"
|
||||
import LayerConfig from "./ThemeConfig/LayerConfig"
|
||||
import GeoLocationHandler from "../Logic/Actors/GeoLocationHandler"
|
||||
import {AvailableRasterLayers, RasterLayerPolygon, RasterLayerUtils} from "./RasterLayers"
|
||||
import { AvailableRasterLayers, RasterLayerPolygon, RasterLayerUtils } from "./RasterLayers"
|
||||
import LayoutSource from "../Logic/FeatureSource/Sources/LayoutSource"
|
||||
import StaticFeatureSource from "../Logic/FeatureSource/Sources/StaticFeatureSource"
|
||||
import FeaturePropertiesStore from "../Logic/FeatureSource/Actors/FeaturePropertiesStore"
|
||||
|
@ -28,24 +32,24 @@ import TitleHandler from "../Logic/Actors/TitleHandler"
|
|||
import ChangeToElementsActor from "../Logic/Actors/ChangeToElementsActor"
|
||||
import PendingChangesUploader from "../Logic/Actors/PendingChangesUploader"
|
||||
import SelectedElementTagsUpdater from "../Logic/Actors/SelectedElementTagsUpdater"
|
||||
import {BBox} from "../Logic/BBox"
|
||||
import { BBox } from "../Logic/BBox"
|
||||
import Constants from "./Constants"
|
||||
import Hotkeys from "../UI/Base/Hotkeys"
|
||||
import Translations from "../UI/i18n/Translations"
|
||||
import {GeoIndexedStoreForLayer} from "../Logic/FeatureSource/Actors/GeoIndexedStore"
|
||||
import {LastClickFeatureSource} from "../Logic/FeatureSource/Sources/LastClickFeatureSource"
|
||||
import {MenuState} from "./MenuState"
|
||||
import { GeoIndexedStoreForLayer } from "../Logic/FeatureSource/Actors/GeoIndexedStore"
|
||||
import { LastClickFeatureSource } from "../Logic/FeatureSource/Sources/LastClickFeatureSource"
|
||||
import { MenuState } from "./MenuState"
|
||||
import MetaTagging from "../Logic/MetaTagging"
|
||||
import ChangeGeometryApplicator from "../Logic/FeatureSource/Sources/ChangeGeometryApplicator"
|
||||
import {NewGeometryFromChangesFeatureSource} from "../Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource"
|
||||
import { NewGeometryFromChangesFeatureSource } from "../Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource"
|
||||
import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader"
|
||||
import ShowOverlayRasterLayer from "../UI/Map/ShowOverlayRasterLayer"
|
||||
import {Utils} from "../Utils"
|
||||
import {EliCategory} from "./RasterLayerProperties"
|
||||
import { Utils } from "../Utils"
|
||||
import { EliCategory } from "./RasterLayerProperties"
|
||||
import BackgroundLayerResetter from "../Logic/Actors/BackgroundLayerResetter"
|
||||
import SaveFeatureSourceToLocalStorage from "../Logic/FeatureSource/Actors/SaveFeatureSourceToLocalStorage"
|
||||
import BBoxFeatureSource from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource"
|
||||
import ThemeViewStateHashActor from "../Logic/Web/ThemeViewStateHashActor";
|
||||
import ThemeViewStateHashActor from "../Logic/Web/ThemeViewStateHashActor"
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -146,7 +150,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
rasterInfo.defaultState ?? true,
|
||||
"Wether or not overlayer layer " + rasterInfo.id + " is shown"
|
||||
)
|
||||
const state = {isDisplayed}
|
||||
const state = { isDisplayed }
|
||||
overlayLayerStates.set(rasterInfo.id, state)
|
||||
new ShowOverlayRasterLayer(rasterInfo, this.map, this.mapProperties, state)
|
||||
}
|
||||
|
@ -158,8 +162,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
* A bit tricky, as this is heavily intertwined with the 'changes'-element, which generate a stream of new and changed features too
|
||||
*/
|
||||
|
||||
|
||||
if (this.layout.layers.some(l => l._needsFullNodeDatabase)) {
|
||||
if (this.layout.layers.some((l) => l._needsFullNodeDatabase)) {
|
||||
this.fullNodeDatabase = new FullNodeDatabaseSource()
|
||||
}
|
||||
|
||||
|
@ -176,18 +179,18 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
let currentViewIndex = 0
|
||||
this.currentView = new StaticFeatureSource(
|
||||
this.mapProperties.bounds.map((bbox) => {
|
||||
if (!bbox) {
|
||||
return empty
|
||||
}
|
||||
currentViewIndex++
|
||||
return <Feature[]>[bbox.asGeoJson({
|
||||
zoom: this.mapProperties.zoom.data,
|
||||
...this.mapProperties.location.data,
|
||||
id: "current_view"
|
||||
}
|
||||
)];
|
||||
if (!bbox) {
|
||||
return empty
|
||||
}
|
||||
)
|
||||
currentViewIndex++
|
||||
return <Feature[]>[
|
||||
bbox.asGeoJson({
|
||||
zoom: this.mapProperties.zoom.data,
|
||||
...this.mapProperties.location.data,
|
||||
id: "current_view",
|
||||
}),
|
||||
]
|
||||
})
|
||||
)
|
||||
this.featuresInView = new BBoxFeatureSource(layoutSource, this.mapProperties.bounds)
|
||||
this.dataIsLoading = layoutSource.isLoading
|
||||
|
@ -355,7 +358,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
|
||||
private initHotkeys() {
|
||||
Hotkeys.RegisterHotkey(
|
||||
{nomod: "Escape", onUp: true},
|
||||
{ nomod: "Escape", onUp: true },
|
||||
Translations.t.hotkeyDocumentation.closeSidebar,
|
||||
() => {
|
||||
this.selectedElement.setData(undefined)
|
||||
|
@ -376,7 +379,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
)
|
||||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{shift: "O"},
|
||||
{ shift: "O" },
|
||||
Translations.t.hotkeyDocumentation.selectMapnik,
|
||||
() => {
|
||||
this.mapProperties.rasterLayer.setData(AvailableRasterLayers.osmCarto)
|
||||
|
@ -395,17 +398,17 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
}
|
||||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{nomod: "O"},
|
||||
{ nomod: "O" },
|
||||
Translations.t.hotkeyDocumentation.selectOsmbasedmap,
|
||||
() => setLayerCategory("osmbasedmap")
|
||||
)
|
||||
|
||||
Hotkeys.RegisterHotkey({nomod: "M"}, Translations.t.hotkeyDocumentation.selectMap, () =>
|
||||
Hotkeys.RegisterHotkey({ nomod: "M" }, Translations.t.hotkeyDocumentation.selectMap, () =>
|
||||
setLayerCategory("map")
|
||||
)
|
||||
|
||||
Hotkeys.RegisterHotkey(
|
||||
{nomod: "P"},
|
||||
{ nomod: "P" },
|
||||
Translations.t.hotkeyDocumentation.selectAerial,
|
||||
() => setLayerCategory("photo")
|
||||
)
|
||||
|
@ -473,10 +476,10 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
),
|
||||
range: new StaticFeatureSource(
|
||||
this.mapProperties.maxbounds.map((bbox) =>
|
||||
bbox === undefined ? empty : <Feature[]>[bbox.asGeoJson({id: "range"})]
|
||||
bbox === undefined ? empty : <Feature[]>[bbox.asGeoJson({ id: "range" })]
|
||||
)
|
||||
),
|
||||
current_view: this.currentView
|
||||
current_view: this.currentView,
|
||||
}
|
||||
if (this.layout?.lockLocation) {
|
||||
const bbox = new BBox(this.layout.lockLocation)
|
||||
|
@ -487,12 +490,19 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
this.featureSwitches.featureSwitchIsTesting
|
||||
)
|
||||
}
|
||||
const currentViewLayer = this.layout.layers.find(l => l.id === "current_view")
|
||||
const currentViewLayer = this.layout.layers.find((l) => l.id === "current_view")
|
||||
if (currentViewLayer?.tagRenderings?.length > 0) {
|
||||
const params = MetaTagging.createExtraFuncParams(this)
|
||||
this.featureProperties.trackFeatureSource(specialLayers.current_view)
|
||||
specialLayers.current_view.features.addCallbackAndRunD(features => {
|
||||
MetaTagging.addMetatags(features, params, currentViewLayer, this.layout, this.osmObjectDownloader, this.featureProperties)
|
||||
specialLayers.current_view.features.addCallbackAndRunD((features) => {
|
||||
MetaTagging.addMetatags(
|
||||
features,
|
||||
params,
|
||||
currentViewLayer,
|
||||
this.layout,
|
||||
this.osmObjectDownloader,
|
||||
this.featureProperties
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -537,7 +547,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
})
|
||||
}
|
||||
{
|
||||
this.selectedElement.addCallback(selected => {
|
||||
this.selectedElement.addCallback((selected) => {
|
||||
if (selected === undefined) {
|
||||
// We did _unselect_ an item - we always remove the lastclick-object
|
||||
this.lastClickObject.features.setData([])
|
||||
|
|
|
@ -123,8 +123,15 @@ export class Unit {
|
|||
)
|
||||
)
|
||||
|
||||
if(json.defaultInput && !applicable.some(denom => denom.canonical.trim() === json.defaultInput)){
|
||||
throw `${ctx}: no denomination has the specified default denomination. The default denomination is '${json.defaultInput}', but the available denominations are ${applicable.map(denom => denom.canonical).join(", ")}`
|
||||
if (
|
||||
json.defaultInput &&
|
||||
!applicable.some((denom) => denom.canonical.trim() === json.defaultInput)
|
||||
) {
|
||||
throw `${ctx}: no denomination has the specified default denomination. The default denomination is '${
|
||||
json.defaultInput
|
||||
}', but the available denominations are ${applicable
|
||||
.map((denom) => denom.canonical)
|
||||
.join(", ")}`
|
||||
}
|
||||
return new Unit(appliesTo, applicable, json.eraseInvalidValues ?? false)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue