Fix viewport when moving at the edges