I have a similar question, but regarding repositioning the camera parallel to the closest front/left/right/back view in Perspective viewport while preserving the vertical position and inclination of the camera. With other words, with this command the camera must only rotate along the Z-axis and pan sideways, until it’s straight to one of the 4 main directions (even better, if it can do that to 3/4 views, too, which means 8 directions).
It would be even better, it that command pans horizontally the center of the scene to the center of the screen only when there are no currently selected objects; However, if there is at least one selected objects upon activating that command, it should pan horizontally to the center of its bounding box instead.
Take this, for example. The closest direction to the camera in image c1.png if front view, therefore this command should rotate it along the Z-axis and pan it sideways, so that the center of the scene is shown in the middle of the Perspevtive vievport (i.e. a locked horizontal pan) and the camera is exactly facing the front of the car (image c2.png). Note that the center of the scene (x0,y0,z0) must not move vertically. This is especially useful in product design, such like furniture, vehicles, boats, buildings etc.
Another example from side view:
PS: 3d connexion devices have either dedicated buttons or software commands to reset the viewports in the 4 main directions while in Perspevtive viewport, but they do it so that the camera is pointing exactly sideways towards the center of the scene, resulting in “parallel” Perspective views that sit very low relative to the 3d model.
PS2: I’m aware that I can unhide the camera with F6 and manually adjust it with the mouse, or I can adjust it with numbers from the View tab in the Properties panel, but both ways are too time consuming and require lots of mouse clicks and/or typing with the keyboard.