satguru Posted January 25, 2016 Share Posted January 25, 2016 In the playground "drag and drop" example, in function "onPointerDown()" the camera is detached from the canvas using following code if (startingPoint) { // we need to disconnect camera from canvas setTimeout(function () { camera.detachControl(canvas); }, 0); // camera.detachControl(canvas); } If I remove the setTimeout() and do "detachControl" directly the code works fine on chrome and firefox but fails in IE In IE the camera becomes a free look camera Whats the significance of the "setTimeout()" function? Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 25, 2016 Share Posted January 25, 2016 A very simple explanation (it can get more complex ) - setTimeout with a value of 0(ms) tells the JS engine to execute the given function after it has ended with its current tasks. It adds this function to be executed and doesn't execute it immediately. I guess that since this function executes native js events unregistration, some engines might have a problem running it. But i don't really know why IE doesn't work. It is just an assumption. Quote Link to comment Share on other sites More sharing options...
satguru Posted January 26, 2016 Author Share Posted January 26, 2016 @RaanamW, What you say makes sense. Would be nice to know what exactly it is in IE that requires us to use setTimeout()? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.