code: function updateMouse(e) {
    input.mouse.clientX = e.clientX;
    input.mouse.clientY = e.clientY;
    input.mouse.buttons = e.buttons;
    if (e.type === 'mouseleave') input.mouse.mouseOnDocument = false;
    else input.mouse.mouseOnDocument = true;
  }
docs: update mouse input tracking