February 9, 2008
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)
From Converting from Window to View Coordinates:
'''Important: Cocoa event objects return y coordinate values that are 1-based instead of 0-based. Thus, a mouse click on the bottom left corner of a window or view would yield the point (0, 1) in Cocoa and not (0, 0). Only y-coordinates are 1-based.'''
So my question is: WTF? Why are y-coords 1 based? And why not x as well? Lazyweb, please enlighten me.
(Tip o' the hat to Jeff Johnson of Lap Cat Software for noticing this.)
Update: From Michael Jurewitz on Twitter: '''NSEvent y-coords are indeed 1-based. It's just a relic of the Display Postscript days'''
Thanks Michael!