I'm trying to incorporate trackballcontrols.js into my project but I need to make some modifications. I'm having trouble understanding this code snippet, could you provide some explanation?
var calculateMousePosition = ( function () {
var vector = new THREE.Vector2();
return function calculateMousePosition( pageX, pageY ) {
vector.set(
( ( pageX - _this.screen.width * 0.5 - _this.screen.left ) / ( _this.screen.width * 0.5 ) ),
( ( _this.screen.height + 2 * ( _this.screen.top - pageY ) ) / _this.screen.width ) // screen.width intentional
);
return vector;
};
}() );