• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSView mouseDown truncated coordinates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView mouseDown truncated coordinates


  • Subject: Re: NSView mouseDown truncated coordinates
  • From: Markus Spoettl <email@hidden>
  • Date: Thu, 23 Feb 2012 13:04:26 +0100

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 (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


  • Follow-Ups:
    • Re: NSView mouseDown truncated coordinates
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: AXUIElementPostKeyboardEvent - not sending key presses to Safari/TextEdit in Lion
  • Next by Date: Re: text field question
  • Previous by thread: Re: NSView mouseDown truncated coordinates
  • Next by thread: Re: NSView mouseDown truncated coordinates
  • Index(es):
    • Date
    • Thread