Updated viewport calculation to use width as largest dimension of screen.