I have ran into this problem even when I programmed a game in Java. I learned about States and what you can do with them. Games practically require them now days. What I mean by that is, instead of using direct usage of Keys and Mouse, you would use them as if its a 1 or 0. If its 0, obviously nothing happens, but if the loop detects a 1, then it reacts according to what mouse button or key or mouse X Y movement you run.
Once that is setup, then going in and out of a screen, such as you show in your pictures above, you would then store the info about your camera somewhere.. as well as your position BEFORE you enter the screen that you want to interact with, then once your done, you restore the position and rotation of your camera back to where it was before. If you set a 1 second delay before accepting mouse input, then the mouse would have no interaction with any of that.
It's a rough outline, but hopefully you can grasp how it would work.
EXAMPLE : Pseudo code :
Do
Check the KeyState Function
if keyY = 1 then print or Do something here
Loop
KeyState Function
If Key "Y" is pressed then KeyY = 1
IF Key "Y" is released then KeyY = 0
EndFunction