Changed scaling algorithm for portrait mode