Is it possible to clear current mouse buttons programmatically?

1. A concise explanation of the problem you’re experiencing.

We’re running into an issue similar to this github issue.

In short, if you hold the left mouse button down while in the Cesium window, and then move the mouse out of the window and release the left mouse button, the window won’t register this ‘button up’ event. Your mouse will get “stuck” in a button-down state even if your left mouse isn’t down. If you re-enter the Cesium window now, the application will behave as if you still have the mouse button down even when you do not. The workaround is simple: you just click again and the issue goes away, but this is still something we’d like to avoid, perhaps by “clearing” or “resetting” the current mouse buttons programmatically.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Just open sandcastle, click in the viewer with the left mouse button, drag outside the window and release. Then re-enter the window and the camera will pan and rotate as if your mouse is still down.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

While I do not know how to fix the issue in the Cesium source code, we were wondering if we could work around this issue by “clearing” the mouse’s button state somehow if the cursor ever leaves the window. Basically, if there was some way to get the mouse out of “pan” or “rotate” mode as soon as the cursor leaves the window, we could use that to work around the aforementioned issue.

4. The Cesium version you’re using, your operating system and browser.

This happens in the most recent version of Cesium (1.64 at the time of writing this post). I’m using Chrome on Windows, although I think this might be platform independent.