• 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
Re: Good mouse tracking design for dynamic view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Good mouse tracking design for dynamic view?


  • Subject: Re: Good mouse tracking design for dynamic view?
  • From: Greg Titus <email@hidden>
  • Date: Thu, 26 Jun 2008 12:17:30 -0700


On Jun 26, 2008, at 11:56 AM, Douglas Davidson wrote:


On Jun 26, 2008, at 11:20 AM, Nathan Vander Wilt wrote:

So it seems I need to do more bookwork myself, but I'm wondering which direction others would recommend:
a) Set up a single tracking area for the whole view, and perform all my own hit testing every time the mouse moves.
b) Keep the per-item tracking areas, but perform my own testing in the edge cases when active (mouse has entered but not exited) tracking areas are getting reset.


Even though it seems like I'd be reimplementing something Cocoa already offers, I'm leaning towards option A: I'm not sure if I'll be able to foresee all the edge cases, and I'd be reinventing half the hit testing code there anyway.
Does it sound reasonable from a maintenance and performance perspective to handle the mouse on my own inside my view? It seems like the tracking Cocoa provides is designed for more static content, or am I just missing the intended "Option C" recipe for my scenario?

If your hit testing is not too time-consuming, it is quite possible to do it on every mouse move. Individual tracking areas are convenient if you don't have your own hit-testing mechanism set up, but if you are able to do it efficiently yourself, you certainly may do so.

What we tend to do when we do hit-testing via mouse move is to also calculate and cache the rect within which the current state is valid. So then at the very top of your hit testing you can do a quick test: is the mouse still within the same area it was before? If so, don't need to do anything and return quickly. This can make hit testing a lot more efficient if you have complicated content.


	- Greg
_______________________________________________

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


References: 
 >Good mouse tracking design for dynamic view? (From: Nathan Vander Wilt <email@hidden>)
 >Re: Good mouse tracking design for dynamic view? (From: Douglas Davidson <email@hidden>)

  • Prev by Date: NSSpeechSynthesizer and a speech dictionary
  • Next by Date: Re: Good mouse tracking design for dynamic view?
  • Previous by thread: Re: Good mouse tracking design for dynamic view?
  • Next by thread: Re: Good mouse tracking design for dynamic view?
  • Index(es):
    • Date
    • Thread