Refactor calculateScalingFactor

1)  Takes into account when the x position is outside of 0 and screenWidth