Added handling of two-direction inversion. Also made sure the resized area is visible.