There are excess shadows when konva draw 1px line,window.devicePixelRatio =1.25?

Viewed 16

strong text I want to draw a finished line for window.devicePixelRatio =1.25;When the browser is zoomed up to 125%;Thank you for your help!!!

enter image description here

<!DOCTYPE html>
<html>

<head>
  <script src="https://unpkg.com/konva@4.0.18/konva.min.js"></script>
  <meta charset="utf-8" />
  <title>Konva Rect Demo</title>
  <style>
    body {
      margin: 0;
      padding: 0;
      overflow: hidden;
      background-color: #f0f0f0;
    }
  </style>
</head>

<body>
  <div id="container"></div>
  <script>
    const width = 400
    const height = 400
    const ratio = window.devicePixelRatio
    console.log(ratio)
    const stage = new Konva.Stage({
      container: 'container',
      width,
      height,
      draggable: false,
    })
    const layer = new Konva.Layer()
    const redLine = new Konva.Line({
      points: [5, 100.5, 200, 100.5],
      // points: pints_arr.va
      stroke: '#fc0303',
      strokeWidth: 1,
    })
    redLine.move({
      x: 0,
      y: 0
    });
    layer.add(redLine)
    stage.add(layer)
  </script>
</body>

</html>

strong text I want to draw a finished line for window.devicePixelRatio =1.25;When the browser is zoomed up to 125%;Thank you for your help!!!

0 Answers
Related