Refactoring: remove _img from Svg.ts

This commit is contained in:
Pieter Vander Vennet 2023-05-08 22:38:47 +02:00
parent 5a2e54b00a
commit 15063f9be0
3 changed files with 4 additions and 6 deletions

View file

@ -73,7 +73,7 @@ export class WikimediaImageProvider extends ImageProvider {
} }
return new Link( return new Link(
Svg.wikimedia_commons_white_img, Svg.wikimedia_commons_white_svg(),
`https://commons.wikimedia.org/wiki/${backlink}`, `https://commons.wikimedia.org/wiki/${backlink}`,
true true
) )

View file

@ -87,7 +87,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)) { if (iconPath !== undefined && iconPath.startsWith(Utils.assets_path)) {
const iconKey = iconPath.substr(Utils.assets_path.length) const iconKey = iconPath.substr(Utils.assets_path.length)
if (Constants.defaultPinIcons.indexOf(iconKey) < 0) { if (Svg.All[iconKey] === undefined) {
throw context + ": builtin SVG asset not found: " + iconPath throw context + ": builtin SVG asset not found: " + iconPath
} }
} }

View file

@ -39,10 +39,8 @@ function genImages(dryrun = false) {
let rawName = name let rawName = name
module += ` public static ${name} = "${svg}"\n` module += ` public static ${name} = "${svg}"\n`
module += ` public static ${name}_img = Img.AsImageElement(Svg.${rawName})\n`
module += ` public static ${name}_svg() { return new Img(Svg.${rawName}, true);}\n` module += ` public static ${name}_svg() { return new Img(Svg.${rawName}, true);}\n`
// module += ` /**@deprecated*/ public static ${name}_ui() { return new FixedUiElement(Svg.${rawName}_img);}\n\n` if (!dryrun) {
if (Constants.defaultPinIcons.indexOf(name) >= 0 && !dryrun) {
allNames.push(`"${path}": Svg.${name}`) allNames.push(`"${path}": Svg.${name}`)
} }
} }
@ -52,4 +50,4 @@ function genImages(dryrun = false) {
console.log("Done") console.log("Done")
} }
genImages(false) genImages()