Jerry Balzano wrote:

OK, on further review ...

The maneuver suggested by David Epstein, although it seemed promising at
first, won't work.  The only way the mouseEnter message gets triggered by
the "receiving" object is (a) if the mouse button is up, and (b) if the
moving control is in a layer *beneath* the receiver (else the receiver
doesn't "see" the cursor).  The documentation on "mouseEnter" verifies all
this.  Since (b) one would generally want to "set the layer to top" for
any "dragged" control, and (a) one would generally have the mouse button
down in such situations, we are double-damned.

So I am back to thinking that in order to have Rev do what I want, i.e.
have any  potential drop locations hilight as soon as the dragged object
(or the pointer) overlaps (enters) its rectangle, I believe I need to (p)
manage a list of potential target-controls and (q) iterate over it until I
find one with the mouseLoc (or some such) enters the rect of it.

I mainly want to know, am I right about this, that there is no easier or
better way?


I don't know (for sure) that there isn't an easier way - but it sounds like you've done a diligent search and not found one yet, so it may be time to go ahead with this way.

Earlier, you said:

I foresee this "solution" scaling badly as the number of controls on the card increases.

You could help the scaling performance by

to (p)
manage a list of potential target-controls and (q) iterate over it until I
find one with the mouseLoc (or some such) enters the rect of it.

Rather than a list of controls, and checking against the rect of it, I'd keep a list of rectangles, as in
x1, y1, x2, y2, "long name of the control"


Then a check that said

on mouseMove newx, newy
  if abs(newx-gLastX) < 10 and abs(newy-gLastY) < 10 then return
  repeat for each line L in gControlList
     if item 1 of L  < newx and newx < item 3 of L  and .... etc.
  end repeat
end mouseMove

would be pretty quick. Only checking when the delta is big enough is a help - and running through a list like this would be quick.
In the unlikely case you do run into performance issues (because you had hundreds or thousands of such controls), you could use some of the fancy geometric sorting techniques to allow you to only check against relatively few of them


--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to