Print: add QR-code to output

This commit is contained in:
Pieter Vander Vennet 2023-11-15 03:42:37 +01:00
parent 24b9f045c8
commit c21e88415d
16 changed files with 544 additions and 185 deletions

View file

@ -3,44 +3,17 @@ import SvelteUIElement from "./UI/Base/SvelteUIElement"
import PointRenderingConfig from "./Models/ThemeConfig/PointRenderingConfig"
import { UIEventSource } from "./Logic/UIEventSource"
import Marker from "./UI/Map/Marker.svelte"
class Test {
public async test() {
await Utils.waitFor(0)
const response = await fetch("http://localhost:1235/layers/atm/atm.json", {
method: "POST",
headers: {
"Content-Type": "application/json;charset=utf-8",
},
body: JSON.stringify({}),
})
}
import Qrcode from "qrcode-generator"
import { FixedUiElement } from "./UI/Base/FixedUiElement"
function generateQr(message: string, attachTo: string) {
const typeNumber = 0
const errorCorrectionLevel = "L"
const qr = Qrcode(typeNumber, errorCorrectionLevel)
qr.addData(message)
qr.make()
document.getElementById(attachTo).innerHTML = qr.createImgTag()
}
const tags = new UIEventSource({
id: "node/13",
amenity: "public_bookcase",
})
const config = new PointRenderingConfig(
{
location: ["point"],
iconSize: "20,20",
marker: [
{
icon: "circle",
color: "orange",
},
{
icon: "./assets/layers/atm.atm.svg",
},
],
},
"test"
generateQr(
"http://127.0.0.1:1234/theme.html?layout=cyclofix&z=14&lat=51.21571770000094&lon=3.219866599996749&layer-range=true&layer-gps_location=false#theme-menu:download",
"qr"
)
new SvelteUIElement(Marker, {
config,
tags,
}).AttachTo("maindiv")
// new Test().test()