Increase QR-code size, make it toggleable

This commit is contained in:
Pieter Vander Vennet 2024-03-19 02:07:10 +01:00
parent 03e82ef3cb
commit 4a8f796f54

View file

@ -1598,6 +1598,9 @@ export default class SpecialVisualizations {
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig
): BaseUIElement { ): BaseUIElement {
const smallSize = 100
const bigSize = 200
const size = new UIEventSource(smallSize)
return new VariableUiElement( return new VariableUiElement(
tagSource tagSource
.map((tags) => tags.id) .map((tags) => tags.id)
@ -1617,11 +1620,17 @@ export default class SpecialVisualizations {
const url = const url =
`${window.location.protocol}//${window.location.host}${window.location.pathname}?${layout}lat=${lat}&lon=${lon}&z=15` + `${window.location.protocol}//${window.location.host}${window.location.pathname}?${layout}lat=${lat}&lon=${lon}&z=15` +
`#${id}` `#${id}`
return new Img(new Qr(url).toImageElement(75)).SetStyle( return new Img(new Qr(url).toImageElement(size.data)).SetStyle(
"width: 75px" `width: ${size.data}px`
) )
}, [size])
).onClick(()=> {
if(size.data !== bigSize){
size.setData(bigSize)
}else{
size.setData(smallSize)
}
}) })
)
}, },
}, },
{ {