Masking Tracking Rects

  • I have a custom view object in which I am drawing some objects. These
    objects can overlap each other and each can have one or more tracking
    rectangles within their own bounds. In certain scenarios, one object
    may overlap part of a tracking rectangle from another object. (I have
    created a picture of this scenario at
    http://www.neuromight.com/images/trackingrect.png to help illustrate
    this.)

    As you can see, it's possible for an object on a foreground layer to
    mask one or two corners of an underlying object's tracking rectangle
    if not the entire tracking rectangle.

    In attempting to draw the tracking rectangles, what is the best way to
    do so, compensating for any objects that might mask tracking
    rectangles of underlying objects?

    Thanks,
    Jason
  • On Sep 19, 2007, at 2:10 AM, Jason Barker wrote:

    > As you can see, it's possible for an object on a foreground layer to
    > mask one or two corners of an underlying object's tracking rectangle
    > if not the entire tracking rectangle.
    >
    > In attempting to draw the tracking rectangles, what is the best way to
    > do so, compensating for any objects that might mask tracking
    > rectangles of underlying objects?
    >

      What are you really trying to accomplish in general? Why not create
    one big tracking rectangle for the visible region of your view and
    determine what to do at the current coordinates (in the same way you
    calculate what to do on mouse down if you're dragging your individual
    elements around as in the Sketch example).

    --
    I.S.
  • I am trying to create a rollover effect within areas of these objects.
    I thought that by creating the tracking rectangles for each specific
    area would yield fewer events that I would have to handle and reduce
    the processing required by my application.

    If I create a tracking rectangle for the rearmost object and then
    create another tracking rectangle which corresponds to the area that
    the foremost object would mask, would the mouse entered event yield
    the tracking rectangle of the foremost object or the rearmost object?

    Is there a simpler way to approach this?

    Thanks,
    Jason

    On 9/19/07, I. Savant <idiotsavant2005...> wrote:
    > On Sep 19, 2007, at 2:10 AM, Jason Barker wrote:
    >
    >> As you can see, it's possible for an object on a foreground layer to
    >> mask one or two corners of an underlying object's tracking rectangle
    >> if not the entire tracking rectangle.
    >>
    >> In attempting to draw the tracking rectangles, what is the best way to
    >> do so, compensating for any objects that might mask tracking
    >> rectangles of underlying objects?
    >>
    >
    > What are you really trying to accomplish in general? Why not create
    > one big tracking rectangle for the visible region of your view and
    > determine what to do at the current coordinates (in the same way you
    > calculate what to do on mouse down if you're dragging your individual
    > elements around as in the Sketch example).
    >
    > --
    > I.S.
    >
    >
    >
  • So I tried adding one tracking rectangle to the view and then another
    one to the view with the same bounds. And when I mouse over that area
    of the view, it seems as through a mouse entered event is fired for
    each tracking rectangle. So adding a tracking rectangle that overlaps
    another does not produce a masking effect.

    Does anyone have a better idea?

    Thanks,
    Jason

    On 9/19/07, Jason Barker <misterbarker...> wrote:
    > I am trying to create a rollover effect within areas of these objects.
    > I thought that by creating the tracking rectangles for each specific
    > area would yield fewer events that I would have to handle and reduce
    > the processing required by my application.
    >
    > If I create a tracking rectangle for the rearmost object and then
    > create another tracking rectangle which corresponds to the area that
    > the foremost object would mask, would the mouse entered event yield
    > the tracking rectangle of the foremost object or the rearmost object?
    >
    > Is there a simpler way to approach this?
    >
    >
    > Thanks,
    > Jason
    >
    > On 9/19/07, I. Savant <idiotsavant2005...> wrote:
    >> On Sep 19, 2007, at 2:10 AM, Jason Barker wrote:
    >>
    >>> As you can see, it's possible for an object on a foreground layer to
    >>> mask one or two corners of an underlying object's tracking rectangle
    >>> if not the entire tracking rectangle.
    >>>
    >>> In attempting to draw the tracking rectangles, what is the best way to
    >>> do so, compensating for any objects that might mask tracking
    >>> rectangles of underlying objects?
    >>>
    >>
    >> What are you really trying to accomplish in general? Why not create
    >> one big tracking rectangle for the visible region of your view and
    >> determine what to do at the current coordinates (in the same way you
    >> calculate what to do on mouse down if you're dragging your individual
    >> elements around as in the Sketch example).
    >>
    >> --
    >> I.S.
    >>
    >>
    >>
    >
  • On Sep 19, 2007, at 9:50 PM, Jason Barker wrote:
    > So I tried adding one tracking rectangle to the view and then another
    > one to the view with the same bounds. And when I mouse over that area
    > of the view, it seems as through a mouse entered event is fired for
    > each tracking rectangle. So adding a tracking rectangle that overlaps
    > another does not produce a masking effect.
    >
    > Does anyone have a better idea?

    Have you determined that the extra events are problematic?    ....
    cause a performance issue that is significant enough to warrant trying
    to go beyond simply minimizing the area of the tracking rect(s) and
    doing a bit of math to see if the mouse is really over something that
    needs to be redrawn?

    Unless you have an unbelievably complex boundary to track, the cost of
    doing a bit of hit detection math is going to be orders of magnitude
    less than the cost of actually drawing state changes as the mouse
    moves.  Doubly so if you are using anything like shadows, reflections,
    or partial transparency.

    b.bum
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today