Re: NSView mouseDown truncated coordinates
Re: NSView mouseDown truncated coordinates
- Subject: Re: NSView mouseDown truncated coordinates
- From: Richard Somers <email@hidden>
- Date: Mon, 28 Nov 2011 07:40:42 -0700
On Nov 25, 2011, at 6:17 PM, Steven Spencer wrote:
> I'm using a NSTrackingArea in a view to receive mouseMoved events.
> The cursor location in the mouseMoved and mouseDragged events have non-integer coordinates (as expected).
> e.g. x:140.601562 y:128.082031
>
> However, the mouseDown and mouseUp events always produce truncated coordinates.
> e.g. x:140.000000 y:128.000000
>
> This causes inaccuracy with hit testing between mouseMoved and mouseDown.
>
> All the mouse events use the same code to convert the point for the view :
>
> NSPoint location = [self convertPoint:[theEvent locationInWindow]
> fromView:nil];
On Nov 26, 2011, at 10:58 AM, Ken Thomases wrote:
> We've seen this, too. It started happening with Lion.
I filed a bug report on this. Bug 9639143 on 20-Jun-2011. I also recently filed a technical support incident asking for resolution or a workaround. The request is pending.
My observations are as follows:
-[NSEvent locationInWindow] can produce non-integral values in Lion with a mouse. This did not happen in previous versions of the OS.
This is a Lion regression.
Using floor, ceil, or round on the returned value does not work because the value can be off by as much as +-1.0.
The amount of error in the value returned can be somewhat random. It is not constant.
-[NSWindow mouseLocationOutsideOfEventStream] also produces non-integral values in Lion with a mouse.
MacOS X 10.1 Application Framework release notes states that "-[NSEvent locationInWindow] may now return NSPoints with non-integral coordinates to represent sub-pixel precision generated by some input devices, for instance tablets." However I do not think that this is relevant because this issue happens with a mouse not a tablet. This issue is not a sub-pixel precision issue. If it was then simple rounding or the like would fix it.
http://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKitOlderNotes
As a side note, I have also noticed that the mouse tracking speed and or acceleration curve is different (think worse) in Lion when using the same system preferences as in Snow Leopard.
In closing it is great to know that others are also having difficulty with this issue. :)
--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