Capture the mouse with the Pointer Lock API, turn its movement into the angles of the view and put them on a camera of your own, without lag and without the view flipping over.