-
-
Notifications
You must be signed in to change notification settings - Fork 41
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: camera controls ignored props #385
fix: camera controls ignored props #385
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey this work perfect, is very professional, thanks for this one.
But remember to update the docs for the component (adding the new props and maybe and example of the type that you can use, better be really explicit for the final user).
@JaimeTorrealba Thanks for the comment, I completely agree, let me work on that 😄 |
I agree with you, I would do it @whereiswolf (maybe you can export it in the defaultExpose ¿?) |
Hmmm 🤔 Wouldn't it cause sort of a "circular" dependency? Also, I don't think it solves the case, because in order to type the ref we'd still need to import some types. <script lang="ts" setup>
...
const cameraControlsRef = shallowRef<{ value: ???, ACTION: ??? }>()
</script>
<template>
<CameraControls
ref="cameraControlsRef"
:mouse-buttons="{ left: cameraControlsRef.ACTION.ZOOM }"
/>
</template> It seems like it's a bit more problematic, we can't just export it as a type, because the import { CameraControls } from 'camera-controls'
...
export type CameraControlsType = typeof CameraControls It would actually make sense to re-export the whole <script lang="ts" setup>
import { CameraControls, CameraControlsSOMETHING } from '@tresjs/cientos'
// CameraControlsSOMETHING is CameraControls from camera-controls
...
const cameraControlsRef = shallowRef<{ value: CameraControlsSOMETHING }>()
</script>
<template>
<CameraControls
ref="cameraControlsRef"
:mouse-buttons="{ left: CameraControlsSOMETHING.ACTION.ZOOM }"
/>
</template> |
@JaimeTorrealba quick summary of the recent changes:
If anything's unclear or should be changed, I'm happy to work on that 😉 |
src/core/controls/CameraControls.vue
Outdated
...touches, | ||
}) | ||
|
||
export { default as CameraControlsClass } from 'camera-controls' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late I was off this weekend.
I love the result. The only thing I am not sure is the name "CameraControlsClass" could that create confusion for some users? (since ThreeJs is basically made in classes)
But I don't have a better name, maybe CameraControlsPointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't sure about that either, what about ThreeCameraControls
or BaseCameraControls
? Maybe I miss something, but Pointers
adds more ambiguity in my opinion 😛.
As one said:
There are only two hard things in Computer Science: cache invalidation and naming things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like BaseCameraControls :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 😉
100% agree :) my suggestion was terrible hahaha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work man!
mouseButtons
andtouches
prop.mouseButtons
andtouches
prop values based on https://yomotsu.github.io/camera-controls/examples/config.htmlmouseButtons
andtouches
.CameraControls
Feel free to point out at any mistakes and discrepancies from conventions. I have a strong React background, and some aspects of Vue are kinda new to me 😜