Reverted to measuring canvas size instead of viewport dimensions.