slight optimization of viewport adjustment