• 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
Tracking Rectangles Vs Manual Logic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tracking Rectangles Vs Manual Logic


  • Subject: Tracking Rectangles Vs Manual Logic
  • From: Lemont Washington <email@hidden>
  • Date: Thu, 2 Dec 2004 16:14:32 -0500

I'd like to know whether its more efficient to use tracking rectangles to determine if the mouse is over a certain region or to do it manually by checking the location in a loop during your NSView's mouseEntered method. For instance, let say you had a view with 50 or 60 that can be clicked or hovered over, this would require you to at least loop over each item in your array looking to see if the mouse pointer is within the bounds of each item in the array. The Sketch AppKit Demo does this I believe. I'm wondering if using Tracking Rectangles is more efficient.

For example it could possibly subdivide your view using a BSP tree or similar data structure so that lets say it determined that the mouse was in a region that is on one half of the screen but not the other, it could discount at least half the items to check against. Is something like this overkill? Does the Apple implementation of tracking rects use a simple loop for bounds checking ors something more efficient speed wise?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Tracking Rectangles Vs Manual Logic
      • From: Ricky Sharp <email@hidden>
    • Re: Tracking Rectangles Vs Manual Logic
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Configuring and Compiling a BSD program against 10.2 Developer on 10.3
  • Next by Date: ColorSync, rendering intents and Cocoa
  • Previous by thread: Re: Configuring and Compiling a BSD program against 10.2 Developer on 10.3
  • Next by thread: Re: Tracking Rectangles Vs Manual Logic
  • Index(es):
    • Date
    • Thread