refactoring: avoid excessive object creation in viewport calculation