on mouseup
send drawline to me in 1 millisec
end mouseup
on mousedown
grab me
send drawline to me in 1 millisec
end mousedown
on mousemove x,y
if the mouseloc is within the rect of grc "w1"
then
send drawline to me in 1 millisec
end if
end mousemove
on drawline
lock screen
put the loc of grc "w1" into tLoc1
put the loc of grc "s1" into tLoc2
set points of grc "l1" to tloc1 & return & tLoc2
relayer grc "l1" to back of this card
unlock screen
end drawline
You should edit your your code to look like this below, Note missing quotes ("drawline"), also be sure to set the style of your graphic controls to polygon
on mouseup
send "drawline" to me in 1 millisec
end mouseup
on mousedown
grab me
send "drawline" to me in 1 millisec
end mousedown
on mousemove x,y
if the mouseloc is within the rect of grc "w1"
then
send "drawline" to me in 1 millisec
end if
end mousemove
on drawline
lock screen
put the loc of grc "w1" into tLoc1
put the loc of grc "s1" into tLoc2
set points of grc "l1" to tloc1 & return & tLoc2
relayer grc "l1" to back of this card
unlock screen
end drawline
Square "w1" (red) can be moved around the screen.
Graphic "l1" is the line between "w1" and "s1" and always stays centered.
It works OK in the IDE. Not working in LC Web 10 RC1 and 9.9.6 RC1.
I am on macOS Big Sur 11.5.2 and tested on Safari 14.1.2, FireFox 96.0.1. and Chrome 97.0.4692.71.
Firefox works the first time but moving the red square too fast makes the page become irresponsive.
Safari works only the first movement and then stops.
Chrome doesn't work at all.
LC 9.9.6 (RC1) gives this error in the message box:
exit(9486744) implicitly called by end of main(), but noExitRuntime, so not exiting the runtime (you can use emscripten_force_exit, if you want to force a true shutdown)