I’ve just shipped another oft-requested feature for Free Ruler: the ability to flip rulers horizontally or vertically.

This one was pretty involved, requiring a complete refactor of the ruler drawing code so that the ticks, labels, drag handle, and mouse ticks render correctly in any orientation. To help troubleshoot the layout code, I created a SwiftUI preview showing 4 sets of rulers, in each possible orientation, with sliders to set the simulate mouse position. This made it easier to adjust the layout logic and validate how the rulers rendered in each orientation.

And of course I added a bunch of UI and unit tests for good measure. (Snicker.)