added logic to prevent panning past the specified left or right edge
Added additional checks to properly manage the top view position on the screen when panning.