To Constrain Pan and Orbit to be Vertical or Horizontal
Hold down Shift as you drag in the viewport.
The initial direction of the drag sets the constraint. If you drag vertically at first, the pan or orbit is constrained to be vertical; if you drag horizontally at first, the constraint is horizontal.