Re: NSView mouseDown truncated coordinates
Re: NSView mouseDown truncated coordinates
- Subject: Re: NSView mouseDown truncated coordinates
- From: Markus Spoettl <email@hidden>
- Date: Thu, 23 Feb 2012 21:09:17 +0100
On 23.02.12 20:07, Quincey Morris wrote:
Up until now (< Lion), it was guaranteed (well, maybe not that, it
just happened to work that way) that the -moveMoved: location
corresponded to the subsequent -mouseDown: location. That meant that
any hover-effects visualized during -mouseMoved: would have been
rendered on objects that react in some way when the mouse goes down on
them.
Aha! You fell into my carefully prepared trap!
[...]
If you're talking about mouseMoved, then you already have a change of
context involved. When the mouse is up, "hover-effects" should
(presumably) refer to which object will be grabbed if you mouse down.
When the mouse is down, they should (presumably) refer to which 2nd
object the dragged object is being dragged to. If you're relying on
mouseMoved to keep the *dragged* object highlighted in some way, I think
you're Doing It Wrong™.
It's not what I'm doing. This is what I do:
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.
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