Is There Some Way to Track Mouse Events Outside the Viewport in HTML5 Builds?

Hello all,

I’ve been trying to write a camera controller functionally very similar to the one used in Google Earth, but I’ve had some issues when getting it to work in HTML5 builds.

So, the ideal behavior is that the user would click the mouse somewhere in the game viewport, and drag to anywhere on the entire screen (including outside the game viewport) to rotate the camera. I’ve tried a number of methods, but I just cannot get the UE4 HTML5 app to register mouse clicks/movement from outside the game viewport.

The current state of my controller is that the user clicks inside the window, drags the cursor to outside the game viewport, and then the camera stops rotating as the cursor leaves. Then, when the user releases the mouse button outside the viewport and moves the cursor back inside, it doesn’t register that the mouse had been released while outside, and starts rotating the camera without the mouse button being clicked.

At this point, just being able to register when the cursor leaves the game viewport would be an incredible help. Even better would be some way to relay mouse position data from HTML5/Js to the game.

Thank you for reading!

1 Like