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

useFollowCam should optionalEl.addEventListener instead of always using document #34

Open
rob-myers opened this issue Mar 4, 2024 · 3 comments

Comments

@rob-myers
Copy link

Thanks for the great library!

When I run two Three.js scenes on the same page,
your <Ecctrl> reacts to events coming from the other scene.

This happens because you document.addEventListener in useFollowCam.tsx.

Could we optionally provide an alternative root element?

@ErdongChen-Andrew
Copy link
Member

I think you could just disable the followCam: <Ecctrl disableFollowCam >

@rob-myers
Copy link
Author

I think you could just disable the followCam: <Ecctrl disableFollowCam >

Sure that works, and since I intend to refactor your code to create my own controller this is not a real problem for me.

But if someone wants to use your library unmodified without writing their own camera, it would be nice to have the option.

Happy to make a PR, and even add some types.

@ErdongChen-Andrew
Copy link
Member

Imo, disableFollowCam should be enough as an option. But if you have any better thoughts or ideas, you are more than welcome to share 👍

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

No branches or pull requests

2 participants