Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add transform property for xyz at once #4

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wrong7
Copy link
Contributor

@wrong7 wrong7 commented Feb 27, 2024

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]}
/>

@bbohlender
Copy link
Contributor

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 bbohlender self-assigned this Feb 27, 2024
@drcmda
Copy link
Member

drcmda commented Feb 28, 2024

@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]

@bbohlender
Copy link
Contributor

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
Copy link
Contributor

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

@wrong7
Copy link
Contributor Author

wrong7 commented Mar 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants