On 28.11.11 15:40, Richard Somers 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.

On Nov 26, 2011, at 10:58 AM, Ken Thomases wrote:

We've seen this, too.  It started happening with Lion.

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.

Little late into this but I'm curious, did you manage to come up with a solution for the issue (I just ran into the same thing)?

As an illustration for the list, I have logged coordinates of a mouse move and a subsequent mouse down event that followed the move event:

mouseMovedToPoint:NSPoint: {217.15625, 343.3984375}
mouseDownAtPoint:NSPoint: {217, 344}

It can (and does) happen that the hit-tests in -mouseMoved: and -mouseDown: return different objects that my view displays. My objects can be very close to each other and 1 pixel actually makes a difference.

Anyone know how to work out mouseDown coordinates one can expect to get when looking at mouseMove coordinates?

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to