Re: NSView mouseDown truncated coordinates
Re: NSView mouseDown truncated coordinates
- Subject: Re: NSView mouseDown truncated coordinates
- From: Steven <email@hidden>
- Date: Sun, 27 Nov 2011 15:17:53 +0000
Many thanks for your replies, Jens and Ken.
I use the mouseMoved event to set the mouse cursor according to whether a NSBezierPath instance contains the mouse point [pathInstance containsPoint:], to indicate whether the path can be moved. There is no scale transformation on the view. On the boundary of the path, the mouseMoved and the mouseDown events disagree whether the mouse point is contained by the path even though the mouse pointer has not moved. e.g. mouseMoved says the point is outside the path, whereas mouseDown says it is inside the path.
The cursor indication gives a false impression that the path cannot be moved when it actually can be moved.
The disagreement is caused by the fractional part of the location coordinates in mouseMoved and the integral coordinates in mouseDown.
I thought that high precision mouse/trackpad movement was possible and that the location could be adjusted to match the screen resolution using NSView centerScanRect. However, centerScanRect (arithmetically) rounds the location to the nearest pixel whereas mouseDown has truncated the location.
It looks like I may have to truncate the coordinates in mouseMoved, to match what mouseDown does.
I noticed that NSWindow mouseLocationOutsideOfEventStream does produce the non-integral coordinates when called from mouseDown, though that may not be the right direction to go.
Steven
_______________________________________________
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