简体   繁体   中英

Problems when applying react-konva rotation

I want to move the shape and change the direction using the arrow key. Moving was successful. But When 'rotation' is applied, the 'text' position changes. How do I keep the text position and only change the orientation of the shape?

https://codesandbox.io/s/modern-dew-d3d8em?file=/src/App.js

You need to put the pivot point in the center of the figure and center the text too

<Circle
 ...
 offsetY={SIZE / 2} 
 offsetX={SIZE / 2}
/>

and

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM