Just make it always set X and Y position of the gun to the X and Y of the mouse, as long as the cursor is within the central area.
E.g. you can do something like,
X of Mouse is between 5 and 200 -> Set X of Gun to X of Mouse
This makes the gun follow the mouse as long as the position of the cursor is within the area between 5 and 200. Similar thing for the Y value.