On 27 May '08, at 8:38 PM, Graham Reitz wrote:

Do folks somehow get the direction of the drag, size of the rectangle, starting x,y, and etc.?

IIRC, there are NSEvent properties that give you the x and y deltas since the last mouseDragged event (called something like -dx or - deltaX...)

More commonly, I store the coordinates of the mouse-down in an NSPoint instance variable and use that while handling mouseDragged and mouseUp. This is sort of an abuse of scope, because that information is specific to the drag operation, not part of the object's state, but it's safe because, as we all know, it's intuitively obvious that there can only be one mouse drag happening at a time.

A cleaner design would be to create some kind of "MouseTracker" object to store the state, and instantiate one on mouse-down and pass the other mouse events to it. But I've never found it worth the trouble to make one.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to