Open fritx opened 7 years ago
Hi, the inspector is awesome and useful, but I met a problem:
After launching inspector, requestAnimationFrame returns undefined instead of an id number which we can call with cancelAnimationFrame.
requestAnimationFrame
undefined
cancelAnimationFrame
I looked through the source code, and found the cause: https://github.com/jeromeetienne/threejs-inspector/blob/df3ef41ad22d3be2fd6be91ac23c425f1b64f4a9/src/vendor/raf-throttler.js#L14-L32
requestAnimationFrame = function(callback){ if( _this.fps === -1 ){ originalFct(function(timestamp){ onAnimationFrame(callback, timestamp) }) }else if( _this.fps > 0 ){ setTimeout(function(){ onAnimationFrame(callback, performance.now()) }, 1000 / _this.fps) }else if( _this.fps === 0 ){ var intervalId = setInterval(function(){ if( _this.fps === 0 ) return clearInterval(intervalId) onAnimationFrame(callback, performance.now()) }, 100) }else { console.assert(false) } }
We should just return the id number while we are rewriting the method.
Hi, the inspector is awesome and useful, but I met a problem:
After launching inspector,
requestAnimationFrame
returnsundefined
instead of an id number which we can call withcancelAnimationFrame
.I looked through the source code, and found the cause: https://github.com/jeromeetienne/threejs-inspector/blob/df3ef41ad22d3be2fd6be91ac23c425f1b64f4a9/src/vendor/raf-throttler.js#L14-L32
We should just return the id number while we are rewriting the method.