Google street view controls

Hey guys I’m trying to recreate google street controls, in this video you can see I’m using a sphere as a center point. My goal is to use the sphere as a pivot when I’m holding the mouse button and not being able to get it off the screen until I have release the mouse and click again on a different place