-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
#136 - fixes left/right/top/bottom pan - thanks goes to @thejmazz #187
Conversation
@hirako2000 @thejmazz So it errored because of scope (arrow function) ? |
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.
Well done
looks like incorrect javascript to me. it doesn't error but doesn't execute a function. its invalid code. no idea how it got there. seems like auto generated by some tool. |
@hirako2000 That was my rewriting of it to es6 😄 |
should I use this issue to reformat the code as well? it's not following whs code style at all. |
@hirako2000 If you have a time - sure |
It is not an issue of const panLeft = () => {
const v = new Vector3();
return function panLeft(distance, objectMatrix) {
v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix
v.multiplyScalar(-distance);
panOffset.add(v);
};
}; instead of const panLeft = (() => {
return (distance, objectMatrix) => {
}
})() which is an IIFE (immediately invoked function expression) for a function that returns another function. Its very similar to a decorator, a decorator is basically the same thing but only for classes. Without decorator: class MyClass extends Component {
...
}
export default myDecorator(...params)(MyClass) with decorator: @myDecorator(...params)
export default class MyClass extends Component {
...
} In the case with orbit controls, the "decorator" is an anonymous function and has no params, but uses The spec for decorator is still young (stage 2) and might change (or never get accepted). See proposal-decorators. |
@thejmazz Thanks for the explanation! |
No description provided.