I am currently using DeviceOrientationEvents
data to animate the rotation of a camera in three.js using DeviceOrientationControls
. The controls are updated with each animation frame, and everything is functioning as expected. However, I have noticed that when I start scrolling, no new DeviceOrientationEvent
is triggered until the scrolling inertia stops.
I have confirmed this by logging from the DeviceOrientationEvent
handler, noticing that events are not dispatched during scrolling. The events continue to fire up until the moment I start scrolling, pause during scrolling, and then resume after the scrolling has stopped.
Even interrupting the scrolling inertia by touching the screen causes the deviceorientation
events to resume.
I have disabled other scroll
event handlers in the script, made touch event handlers passive, tried making them non-passive, and disabled all touch event handlers altogether.
From my troubleshooting, it seems that the issue may be related to how the scroll thread and IMU data processing are scheduled in the browser, potentially having no immediate solution. However, I'm reaching out here in case there is something I may have overlooked. This issue doesn't seem to stem from three.js or DeviceOrientationControls
, but I've tagged it just in case someone has encountered a similar problem.
In my specific scenario, DeviceOrientationControls
is active while scrolling because scrolling drives the animation of a "camera rig" (consisting of animated empty objects), while moving the phone rotates the camera itself. It's akin to being able to look around while moving in a railcar.
I've tested this on an iPhone 11 Pro with iOS 13.5.1, using Chrome iOS 84 and Safari. I have not tested it on Android devices.