Skip to content

Browser canvas size is overwritten #396

@siikasmaa

Description

@siikasmaa

When rendering the QR code on a canvas in the browser the existing canvas size is overwritten. This is problematic when rendering more than the QR code in the canvas.

In the file lib/renderer/canvas.js:

function clearCanvas (ctx, canvas, size) {
  ctx.clearRect(0, 0, canvas.width, canvas.height)

  if (!canvas.style) canvas.style = {}
  canvas.height = size
  canvas.width = size
  canvas.style.height = size + 'px'
  canvas.style.width = size + 'px'
}

The function clearCanvas should conditionally set the size for the canvas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions