[comp.sys.mac.programmer] drawing a polygon w/the mouse

matt@hermes.cs.uh.edu (08/02/90)

Hi.  Does anyone have any pointers to some sample code on how to let the user
draw a polygon in the manner of MacDraw? (i.e. click to start the polygon,
rubberband the line, click for the next vertex, etc., and double-click to
stop.)

I've got the rubberbanding down, but I'm having a bit of a hard time detecting
the double-click to signify the end.  My current, inelegant approach is
to say delay(GetDblTime, tix) and then see if there's a mouse down event in
the queue after each new vertex is created.  Pretty cheesy, huh?

Another thing I was wondering -- I'm using an xor transfer mode, but I
noticed that apparently programs like HyperCard don't.  How do they make it
so you can rubberband a solid line and not wipe out the rest of the screen?

Thanks for any help you can send my way.

-------------------------------------------------------------------------------
Matt Emerson
matt@cs.uh.edu