• 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
NSView mouseDown truncated coordinates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSView mouseDown truncated coordinates


  • Subject: NSView mouseDown truncated coordinates
  • From: Steven Spencer <email@hidden>
  • Date: Sat, 26 Nov 2011 01:17:08 +0000

Hi,

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];

Logged as e.g.

    NSLog(@"moved x:%f y:%f", location.x, location.y);

What is the correct way to obtain coordinates that are consistent across all the mouse events ?
Thanks.

Steven

(Xcode 4.2.1 64bit LLVM 3.0 ARC)
_______________________________________________

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: Richard Somers <email@hidden>
    • Re: NSView mouseDown truncated coordinates
      • From: Ken Thomases <email@hidden>
    • Re: NSView mouseDown truncated coordinates
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: NSTableView Binding NSSortDescriptor
  • Next by Date: Re: "byte orders" question
  • Previous by thread: Re: NSTableView Binding NSSortDescriptor
  • Next by thread: Re: NSView mouseDown truncated coordinates
  • Index(es):
    • Date
    • Thread