Reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2022-09-08 21:40:48 +02:00
parent e22d189376
commit b541d3eab4
382 changed files with 50893 additions and 35566 deletions

View file

@ -1,43 +1,49 @@
import WithContextLoader from "./WithContextLoader";
import TagRenderingConfig from "./TagRenderingConfig";
import {Utils} from "../../Utils";
import LineRenderingConfigJson from "./Json/LineRenderingConfigJson";
import WithContextLoader from "./WithContextLoader"
import TagRenderingConfig from "./TagRenderingConfig"
import { Utils } from "../../Utils"
import LineRenderingConfigJson from "./Json/LineRenderingConfigJson"
export default class LineRenderingConfig extends WithContextLoader {
public readonly color: TagRenderingConfig;
public readonly width: TagRenderingConfig;
public readonly dashArray: TagRenderingConfig;
public readonly lineCap: TagRenderingConfig;
public readonly offset: TagRenderingConfig;
public readonly fill: TagRenderingConfig;
public readonly fillColor: TagRenderingConfig;
public readonly color: TagRenderingConfig
public readonly width: TagRenderingConfig
public readonly dashArray: TagRenderingConfig
public readonly lineCap: TagRenderingConfig
public readonly offset: TagRenderingConfig
public readonly fill: TagRenderingConfig
public readonly fillColor: TagRenderingConfig
public readonly leftRightSensitive: boolean
constructor(json: LineRenderingConfigJson, context: string) {
super(json, context)
this.color = this.tr("color", "#0000ff");
this.width = this.tr("width", "7");
this.dashArray = this.tr("dashArray", "");
this.lineCap = this.tr("lineCap", "round");
this.fill = this.tr("fill", undefined);
this.fillColor = this.tr("fillColor", undefined);
this.color = this.tr("color", "#0000ff")
this.width = this.tr("width", "7")
this.dashArray = this.tr("dashArray", "")
this.lineCap = this.tr("lineCap", "round")
this.fill = this.tr("fill", undefined)
this.fillColor = this.tr("fillColor", undefined)
this.leftRightSensitive = json.offset !== undefined && json.offset !== 0 && json.offset !== "0"
this.leftRightSensitive =
json.offset !== undefined && json.offset !== 0 && json.offset !== "0"
this.offset = this.tr("offset", "0");
this.offset = this.tr("offset", "0")
}
public GenerateLeafletStyle(tags: {}):
{ fillColor?: string; color: string; lineCap: string; offset: number; weight: number; dashArray: string; fill?: boolean } {
public GenerateLeafletStyle(tags: {}): {
fillColor?: string
color: string
lineCap: string
offset: number
weight: number
dashArray: string
fill?: boolean
} {
function rendernum(tr: TagRenderingConfig, deflt: number) {
const str = Number(render(tr, "" + deflt));
const n = Number(str);
const str = Number(render(tr, "" + deflt))
const n = Number(str)
if (isNaN(n)) {
return deflt;
return deflt
}
return n;
return n
}
function render(tr: TagRenderingConfig, deflt?: string) {
@ -47,19 +53,17 @@ export default class LineRenderingConfig extends WithContextLoader {
if (tr === undefined) {
return deflt
}
const str = tr?.GetRenderValue(tags)?.txt ?? deflt;
const str = tr?.GetRenderValue(tags)?.txt ?? deflt
if (str === "") {
return deflt
}
return Utils.SubstituteKeys(str, tags)?.replace(/{.*}/g, "");
return Utils.SubstituteKeys(str, tags)?.replace(/{.*}/g, "")
}
const dashArray = render(this.dashArray);
let color = render(this.color, "#00f");
const dashArray = render(this.dashArray)
let color = render(this.color, "#00f")
if (color.startsWith("--")) {
color = getComputedStyle(document.body).getPropertyValue(
"--catch-detail-color"
);
color = getComputedStyle(document.body).getPropertyValue("--catch-detail-color")
}
const style = {
@ -67,7 +71,7 @@ export default class LineRenderingConfig extends WithContextLoader {
dashArray,
weight: rendernum(this.width, 5),
lineCap: render(this.lineCap),
offset: rendernum(this.offset, 0)
offset: rendernum(this.offset, 0),
}
const fillStr = render(this.fill, undefined)
@ -80,7 +84,5 @@ export default class LineRenderingConfig extends WithContextLoader {
style["fillColor"] = fillColorStr
}
return style
}
}
}