pmndrs / react-three-flex

💪📦 Flexbox for react-three-fiber
MIT License
1.65k stars 42 forks source link

Added centerAcnhor prop on Flex, which centers it on position #64

Closed saitonakamura closed 3 years ago

saitonakamura commented 3 years ago

With centerAnchor={true} Flex starts behaving like a usual threejs element - it centers itself on a position, rather than having this position as left-upper corner

Besides the fact that this easier to work with (now you don't have to do this manually via -width / 2), the usecase is when you rotate the Flex to face the camera. If you do it without the centerAnchor with position={[-width/2, height/2]}, rotation will behave like the center is shifted (when in fact, it's not)