Fix API errors when panning off the start/end of a sequence
Limit panning to valid sequence positions

Also add 'clamp' helper function to simplify a few spots.
Fix pan limiting typo
Merge branch 'master' into new-ui

Conflicts:
	static/js/readgraph.js