Upon my observation, the TrackballControls
provided by @WestLangley appears to be significantly slower compared to an earlier version utilized in this particular example.
Feel free to experiment with the new code here: https://jsfiddle.net/vt8n6dcs/1/
And here's the old code for comparison: https://jsfiddle.net/vt8n6dcs/
My testing was done using Firefox 41.0.2. Although no official benchmarks were conducted, the performance decline is noticeable, especially when initiating mouse rotations, causing occasional lag in image updates. This issue exists with the old version as well, albeit less frequently. Surprisingly, the performance seems consistent in Chrome 48.0.2564.82.
Additionally, the mouse sensitivity is notably reduced. It requires extensive movement to observe a substantial impact on the image, regardless of whether on Firefox or Chrome.
The sole drawback I encountered with the old version is the constant adjustment of the command center to the page center. This can be rectified by integrating the updated version's code for the handleResize()
function:
this.handleResize = function () {
if ( this.domElement === document ) {
this.screen.offsetLeft = 0;
this.screen.offsetTop = 0;
this.screen.width = window.innerWidth;
this.screen.height = window.innerHeight;
} else {
var box = this.domElement.getBoundingClientRect();
// adjustments come from similar code in the jquery offset() function
var d = this.domElement.ownerDocument.documentElement;
this.screen.offsetLeft = box.left + window.pageXOffset - d.clientLeft;
this.screen.offsetTop = box.top + window.pageYOffset - d.clientTop;
this.screen.width = box.width;
this.screen.height = box.height;
}
this.radius = ( this.screen.width + this.screen.height ) / 4;
};