pmndrs / react-three-flex

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

Unexpected positioning of Box object #88

Open gormlabenz opened 1 year ago

gormlabenz commented 1 year ago

Issue description: When placing a Box object within a Flex object, unexpected positional values are observed. For flex-direction="column", the x position is 0.5 and for flex-direction="row", the y position is -0.5 when justifyContent="center" and alignItems="center" are applied. This is inconsistent with the expected values of 0.

Expected behavior: The Box object, when placed inside a Flex object with justifyContent="center" and alignItems="center" applied, should result in x and y position values of 0.

Actual behavior: The actual x position for flex-direction="column" is 0.5, and the y position for flex-direction="row" is -0.5.

Steps to reproduce:

  1. Create a Box object inside a Flex object.
  2. Apply justifyContent="center" and alignItems="center" to the Flex object.
  3. Log the x position value for flex-direction: column and y position value for flex-direction: row.

Minimal reproduction of the problem with instructions: You can view and interact with a minimal reproduction of the issue here: https://stackblitz.com/edit/stackblitz-starters-n7vn5a?file=src%2FApp.tsx. In this example, clicking on the canvas will log the positional values.

Impact: This issue is causing the Box object to not center properly within the Flex object and is also affecting the usage example in the documentation.

Additional notes: Uncertain if this issue is a bug or a misunderstanding of the library's expected functionality. Any clarification or guidance would be highly appreciated.