forked from MapComplete/MapComplete
Add QR-code to all popups, add direction indicator to popup and visual feedback, make reviews accessible to screenreaders (both to read them and to make them)
This commit is contained in:
parent
5567869bb4
commit
bfd818cb38
33 changed files with 415 additions and 98 deletions
|
|
@ -4,23 +4,20 @@ import Qrcode from "qrcode-generator"
|
|||
* Creates a QR-code as Blob
|
||||
*/
|
||||
export default class Qr {
|
||||
private _textToShow: string
|
||||
private readonly _textToShow: string
|
||||
|
||||
constructor(textToShow: string) {
|
||||
this._textToShow = textToShow
|
||||
}
|
||||
|
||||
public toImageElement(totalSize: number): string {
|
||||
console.log("Creating a QR code for", this._textToShow)
|
||||
const typeNumber = 0
|
||||
const errorCorrectionLevel = "L"
|
||||
const qr = Qrcode(typeNumber, errorCorrectionLevel)
|
||||
qr.addData(this._textToShow)
|
||||
qr.make()
|
||||
const moduleCount = qr.getModuleCount()
|
||||
const img = document.createElement("img")
|
||||
const cellSize = Math.round(totalSize / moduleCount)
|
||||
console.log("Cellsize", cellSize)
|
||||
return qr.createDataURL(cellSize)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue