Localize variables in setPanBounds

Oops, forgot to do this before!