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

fix: transformControls throws error when switching active camera #367

Conversation

franciscohermida
Copy link
Contributor

closes #366

Since TransformControls needs a camera in the constructor and I haven't found a way to change the camera once it is instantiated the solution I found is to add a :key to force it to be recreated.

This probably has to be considered for all components where the camera (or other dependencies) is used in the constructor and there is no proper way of setting it after it was created?

Copy link

stackblitz bot commented Mar 17, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@JaimeTorrealba
Copy link
Member

Hi thanks for reach this.

Others controllers have the camera props where you can pass any specific camera as a prop using reactivity. I would this follow that pattern could be better and less error-prone. What do you think?

Look for example the map controls: https://github.com/Tresjs/cientos/blob/main/src/core/controls/MapControls.vue
Do something like that with the transformControls (I believe this was added a posteriori and the transformControls didn't was updated)

@franciscohermida
Copy link
Contributor Author

Thanks for reviewing, will try your suggestion

Copy link
Member

@JaimeTorrealba JaimeTorrealba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks man

@JaimeTorrealba JaimeTorrealba merged commit 45093fd into Tresjs:main Apr 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

TransformControls throws error when switching active camera
2 participants