我react-konva用于绘图目的。我已经配置了stage并且正在该stage容器中绘制某些形状。我面临的问题是原点坐标(0,0)位于舞台容器的左上角。我希望舞台的中心是原点(0,0)。这是目前的代码:
<Stage
height={800}
width={1200}
style={{ backgroundColor: '#fff', border: 'solid'}}>
{
this.state.circlePoints.length !== 0 &&
<LineComponent
startX={1200/2}
startY={800/2}
endX={this.state.circlePoints[0].pointX*1.3}
endY={this.state.circlePoints[0].pointY*1.3}
startColor={firstCircle[0].outerColor}
endColor={pmData[0].outerColor}
/>
}
<CircleComponent
x={1200/2}
y={800/2}
outerRadius={firstCircle[0].weight*1200}
outerColor={firstCircle[0].outerColor}
innerRadius={firstCircle[0].weight*1200*0.3}
innerColor={firstCircle[0].innerColor}
shadowColor={firstCircle[0].innerColor}
getCirclePoints={this.getCirclePoints}
/>
{
this.state.circlePoints.length !== 0 &&
<CircleComponent
x={this.state.circlePoints[0].pointX*1.3}
y={this.state.circlePoints[0].pointY*1.3}
outerRadius={pmData[0].weight*1200}
outerColor={pmData[0].outerColor}
innerRadius={pmData[0].weight*1200*0.3}
innerColor={pmData[0].innerColor}
shadowColor={pmData[0].innerColor}
/>
}
</Stage>