2

I'm using react-konva

when I render a <Stage /> with width:750, it will render a <canvas /> element with width 750 * devicePixelRatio

<Stage width={750} />

will render (in iPhone 7)

<canvas width="1500" />

How do I disable this behavior ?

Littlee
  • 3,791
  • 6
  • 29
  • 61

1 Answers1

5
import Konva from 'konva';

Konva.pixelRatio = 1;

But in the case image on HDPI display (such as retina) will look blurred.

lavrton
  • 18,973
  • 4
  • 30
  • 63
  • But also prevent 'layer.getContext().getImageData' from returning completely wrong results on those HDPI displays or any other zoomed browser window. This should be the default setting. – Roman K Oct 11 '19 at 09:31