Re: NSView mouseDown truncated coordinates
Re: NSView mouseDown truncated coordinates
- Subject: Re: NSView mouseDown truncated coordinates
- From: Greg Parker <email@hidden>
- Date: Thu, 23 Feb 2012 19:52:07 -0800
On Feb 23, 2012, at 12:09 PM, Markus Spoettl <email@hidden> wrote:
> 1) On -mouseMoved: locate object under the cursor and highlight it so the user knows which one of them will be operated on when the mouse goes down.
>
> 2) On -mouseDown: locate object under the cursor and prepare it for dragging (by remembering it).
>
> 3) On -mouseDragged: drag the object selected in (2)
>
> Pretty standard stuff. Of course this relies on steps (1) and (2) locating the same object.
>
> Apparently one can't assume (1) and (2) produce the same coordinates, although I think that's a bug or at least it's unclear what the relationship of coordinates between mouseMoved: and mouseDown: is.
One alternative:
1. On -mouseMoved: locate and highlight and remember the object under the cursor
2. On -mouseDown: do nothing
3. On -mouseDragged: drag the most recent object remembered by #1.
This works if the difference between the last -mouseMoved: and -mouseDown: is not too large. Try both and see which gives the better user experience.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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