Re: Event Objects Return 1-Based Y Coordinate Values
Re: Event Objects Return 1-Based Y Coordinate Values
- Subject: Re: Event Objects Return 1-Based Y Coordinate Values
- From: Richard Somers <email@hidden>
- Date: Mon, 27 Jun 2011 12:39:57 -0600
The documentation matches the behavior. Cocoa event objects do indeed return y coordinate values that are 1-based. A mouse click on the bottom left corner of a window or view yields the point (0, 1) in Cocoa and not (0, 0).
I recently submitted bug 9639143 on another issue but it has a sample application that readily demonstrates this behavior. You are more than welcome to check this out yourself. Unless I am doing something horribly wrong, as far as I can tell, the documentation does indeed match the behavior so there is certainly very little to be gained in submitting a bug report.
If you have not read the documentation I would suggest you do so. It is on page 49 of the Cocoa Drawing Guide under the heading "Converting from Window to View Coordinates".
The documentation is very clear on this behavior. The only thing that is left unsaid in the documentation is why this unusual behavior exists or what purpose it has.
--Richard
On Jun 27, 2011, at 11:26 AM, Raleigh Ledet wrote:
> Cocoa coordinates are all 0,0 based. If you have a reproducible test case that says otherwise, please file a radar and attach it.
>
> -raleigh
>
> On Jun 25, 2011, at 7:59 AM, Richard Somers wrote:
>
>> The Cocoa Drawing Guide states "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."
>>
>> Why are the y-coordianate values of Cocoa event objects 1-based?
>>
>> Do most developers simply subtract 1.0 from the y-coordianate value obtained from an event object to make it 0-based before using the x-y-coordinate values?
>>
>> --Richard
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden