reactjs / react-art

React Bridge to the ART Drawing Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to keep the line same width?

sherdeadlock opened this issue · comments

commented

The top line is thinner than others. ("react-art": "^0.14.0")

strokewidth

import React from 'react';
import { Surface, Group, Shape, Path } from 'react-art';

function Line() {
  const d = Path();
  d.moveTo(10, 10).lineTo(10, 0).lineTo(300, 0).lineTo(300, 10);
  return <Shape stroke="#000000" strokeWidth={1} d={d} />;
}

export default function App() {
  return <Surface width={500} height={300}>
    <Line />
    <Group x={10} y={5}>
      <Line />
    </Group>
  </Surface>;
}

I would guess that the stroke is centered on the top border of the canvas, so half of it is outside and gets cut off.

commented

The borders are in the same situation.
Is it a normal behaviour? Have to set the margin myself.