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

clientToSurface & surfaceToClient signatures #658

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

alper-batioglu
Copy link
Contributor

Added clientToSurface and surfaceToClient signatures.

surfaceToClient has x, y and z optional, but if none of them is provided, it strangely returns a Matrix, which I did not understand, but did not try to understand as well 😁. Line with an empty object parameter on top of real signature is for intellisense of the ReturnType.

same thing is also true for clientToSurface with missing arguments.

@jonobr1
Copy link
Owner

jonobr1 commented Aug 16, 2022

The return type is a symptom of underlying matrix math. To get these calculations I use matrices. matrix.multiply is overloaded with many different types of multiplying. If there are 2 or 3 arguments it returns a vector, but if there are 1 or >3 than it returns a matrix.

@jonobr1
Copy link
Owner

jonobr1 commented Aug 16, 2022

This looks god, though in a future release I will be removing Two.ZUI (any extras) from the default types declarations. I would love your feedback on good ways to add types declarations to more "external" files in the repo. If you have any thoughts, please share them here: #660

@jonobr1 jonobr1 merged commit a5b9762 into jonobr1:dev Aug 16, 2022
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.

2 participants