Open promontis opened 3 years ago
I've added flipping like this...
const [flipMainAxis, setFlipMainAxis] = useState(false);
const [flipSecondaryAxis, setFlipSecondaryAxis] = useState(false);
const mainAxis = flexDirection === "row" ? plane[0] : plane[1];
const secondaryAxis = flexDirection === "row" ? plane[1] : plane[0];
let scale = [
(flipMainAxis && mainAxis === "x") ||
(flipSecondaryAxis && secondaryAxis === "x")
? -1
: 1,
(flipMainAxis && mainAxis === "y") ||
(flipSecondaryAxis && secondaryAxis === "y")
? -1
: 1,
(flipMainAxis && mainAxis === "z") ||
(flipSecondaryAxis && secondaryAxis === "z")
? -1
: 1
];
<group scale={scale}>
<Flex ...>
</group>
Is this the way to go?
Hi @promontis, really sorry for inactivity on your issue, we will look at it in depth ASAP.
Just a little tip: have you considered the -reverse
variant? Like row-reverse
and column-reverse
.
Hi all!
First of all, thanks for this awesome library! It is really really cool!
I've had a hard time figuring out how the axis orientation works. I've created a sandbox here to get some more grip on it: https://codesandbox.io/s/hardcore-fog-0eqrh?file=/src/App.js
Note that I've added the
AxesHelper
to help me know which axis is what.While typing this everything started making a lot more sense... hopefully this process also helps others...
I've concluded that - when I choose
flexDirection="row"
- it first layouts the boxes (you pick how many boxes you want, but after 4 boxes it should wrap) on the axis of thefirst
character of theplane
. So say, for plane XY the boxes layout in the direction of the X axis, but after 3 boxes, the wrapping occurs on the Y axis. Hence, XY. When I pickflexDirection="column"
it does the same thing, but now it layouts on Y first (second character) and then wraps on X.This is consistent for all planes. The difference between XY and XZ is that the first one will wrap on the Y axis, and the second will wrap on the Z axis.
When there is no wrapping configured, there is no difference between selecting XY or XZ - when selected
flexDirection="row"
.I do wonder why it layouts like this:
AxesHelper
X lineAxesHelper
Y lineAxesHelper
Y lineAxesHelper
Z lineAxesHelper
X line (same as 1.)AxesHelper
Z line (same as 4.)So: A) I cannot layout AWAY from the direction of the
AxesHelper
X line. Only TO (1. and 5.) B) I can layout TO and AWAY to/from the direction of theAxesHelper
Y line (2. and 3.) C) I cannot layout TO the direction of theAxesHelper
Z line. Only AWAY (4. and 6.)Is this by design? If so, how can I do A or C? Should I flip something, so that it goes to the correct direction?