uikit icon indicating copy to clipboard operation
uikit copied to clipboard

feat: add transform property for xyz at once

Open wrong7 opened this issue 1 year ago • 5 comments

Added transform properties to set rotation, and translate in XYZ axis with a single line

Example

Before:

<Container
  transformRotateX={-5}
  transformRotateY={-5}
  transformRotateZ={-5}
  transformTranslateX={7}
  transformTranslateY={2}
  transformTranslateZ={10}
/>

After:

<Container
  transformRotate={[-5, -5, -5]}
  transformTranslate={[7, 2, 10]}
/>

wrong7 avatar Feb 27 '24 11:02 wrong7

Thanks for the PR The problem with this implementation is unexpected behavior for

<Container transformTranslation={[1,2,3]} transformTranslationX={100} />

To implement the expected behavior for this case you want to create a new property transformation that extends the transformAliasPropertyTransformation one provide that to useGetBatchedProperties. The new property transformation should then, convert transformationTransformation tosetProperty("transformationTransformationX", p[0]); etc.

bbohlender avatar Feb 27 '24 11:02 bbohlender

@bbohlender why unexpected? jsx has guaranteed order. this would work in fiber/react

<mesh position={[1,2,3]} position-x={2} /> // position === [2,2,3]

drcmda avatar Feb 28 '24 23:02 drcmda

Yes, but the current implementation in the PR turns

<Container transformTranslation={[1,2,3]} transformTranslationX={100} />

into transformTranslation={[1,2,3]} I already described how to preserve the order of jsx properties when applying them :)

bbohlender avatar Feb 28 '24 23:02 bbohlender

@wrong7 Was my comment regarding the unexpected behavior clear? If you don't have time, I can also take over this PR

bbohlender avatar Mar 06 '24 23:03 bbohlender

Yes it was clear, sorry I didn't update the PR. I still haven't got used to the code and I don't have much free time to make it, so you can take over

wrong7 avatar Mar 07 '24 07:03 wrong7

I'll close this for house keeping. If this feature is important, let's create an issue for it and prioritize it ;-)

bbohlender avatar Jul 25 '24 15:07 bbohlender