mechanic icon indicating copy to clipboard operation
mechanic copied to clipboard

Fuzzy engine-canvas function on retina

Open runemadsen opened this issue 2 years ago • 0 comments

Describe the bug The canvas element for @mechanic-design/engine-canvas looks fuzzy on retina screen because of the 2-pixel density required.

To Reproduce Steps to reproduce the behavior:

  1. Create a design function with @mechanic-design/engine-canvas that is 400x400
  2. Press "generate"
  3. See the fuzzy out because the canvas should really be 800x800

Expected behavior A clear and beautiful output no matter the screen :)

Screenshots Screen Shot 2022-09-02 at 11 54 40 AM

Desktop (please complete the following information):

  • OS: OSX
  • Browser Chrome
  • Version All

Additional context I think the solution should be that when a design function made with @mechanic-design/engine-canvas is rendered for preview (only), we should double the size of the canvas, run scale(2, 2) on the context, and use CSS to show the canvas at the normal size. This technique is explained here. If the user presses "generate" to download a file, the file should be normal size.

runemadsen avatar Sep 02 '22 10:09 runemadsen