I noticed that the TrackballControls associated with @WestLangley is much slower than the old version used by this example .
Script with new code: https://jsfiddle.net/vt8n6dcs/1/
Script with old code: https://jsfiddle.net/vt8n6dcs/
I tested it with Firefox 41.0.2. No benchmarks, performance degradation is pretty obvious, because when you start spinning with the mouse, sometimes the image update lags. This also happens with the old version, but much less frequently. Not surprisingly, the performance in the Chrome browser 48.0.2564.82 looks exactly the same.
In addition, mouse sensitivity is much lower. You need to move a lot to significantly affect the image. This happens in both Firefox and Chrome.
The only problem I encountered with the old version is that the command center is always set in the center of the page. You can fix this using the new version 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; };
Marco sulla
source share