code: function (event) {
      var direction;
      var movementX;
      var movementY;
      var pitchObject = this.pitchObject;
      var previousMouseEvent = this.previousMouseEvent;
      var yawObject = this.yawObject;
  
      // Not dragging or not enabled.
      if (!this.data.enabled || (!this.mouseDown && !this.pointerLocked)) { return; }
  
      // Calculate delta.
      if (this.pointerLocked) {
        movementX = event.movementX || event.mozMovementX || 0;
        movementY = event.movementY || event.mozMovementY || 0;
      } else {
        movementX = event.screenX - previousMouseEvent.screenX;
        movementY = event.screenY - previousMouseEvent.screenY;
      }
      this.previousMouseEvent = event;
  
      // Calculate rotation.
      direction = this.data.reverseMouseDrag ? 1 : -1;
      yawObject.rotation.y += movementX * 0.002 * direction;
      pitchObject.rotation.x += movementY * 0.002 * direction;
      pitchObject.rotation.x = Math.max(-PI_2, Math.min(PI_2, pitchObject.rotation.x));
    }
docs: Translate mouse drag into rotation.
  
  Dragging up and down rotates the camera around the X-axis (yaw).
  Dragging left and right rotates the camera around the Y-axis (pitch).