Can I draw a line (or better any polygon) directly on screen?
Igor Couto
igor at pixelmedia.com.au
Thu Jul 10 04:09:01 EDT 2003
Hi all,
On Thursday, July 10, 2003, at 03:57 AM, Richard Gaskin wrote:
>> On Tuesday, July 8, 2003, at 02:30 AM, Joël Guillod wrote:
>>
>>> Is there a easy way to draw any line on screen?
>>
>> Maybe you can draw a line in separate stack and use windowShape.
>>
Without having tried any of this, how about this solution:
1) Make a stack with only 1 single object - a line.
2) Using the windowShape property, set the stack to be totally
transparent (you can do this by using an image which is totally
transparent as the 'shape' for the windowShape property).
This means that in this stack, the only object able to be seen and to
receive user-triggered events is the LINE you placed previously. This
stack is effectively THE CONNECTING LINE you wish to 'draw' between the
2 drag-and-drop points.
3) Hide the 'line stack'.
Now, the tricky part: you want the line to SHOW up when the user first
clicks down on 'stack 1', RESIZES as the user moves the mouse, and then
HIDE when the user releases the mouse over 'stack 2' (I suppose this is
the behaviour you want). To do this:
1) 'Stack 1' must have a handler 'on mouseDown', which SHOWS the stack
'line', resizes the line, and positions it right underneath the mouse
cursor.
2) the 'Line' stack has to have a handler 'on mouseMove' that RESIZES
the line (ie, re-sets the 'points' property of the line).
3) the 'Line' stack also has to have a handler 'on mouseUp' that hides
itself.
As I said, I haven't actually tried implementing any of this, but in my
(Rev newbie) mind, it feels as if it should work!
Good Luck!
--
Igor de Oliveira Couto
----------------------------------
igor at pixelmedia.com.au
----------------------------------
More information about the use-livecode
mailing list