#136 - fixes left/right/top/bottom pan - thanks goes to @thejmazz#187
#136 - fixes left/right/top/bottom pan - thanks goes to @thejmazz#187sasha240100 merged 1 commit intobetafrom
Conversation
|
@hirako2000 @thejmazz So it errored because of scope (arrow function) ? |
|
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.