I need a "slider" in a circle
Colin Holgate
colinholgate at gmail.com
Tue Jul 4 12:27:21 EDT 2017
Here is a version that would work for a complete circle:
global cw,ch,cx,cy,offx,offy
on mousedown
put the width of graphic "circle" / 2 into cw
put the height of graphic "circle" / 2 into ch
put the left of graphic "circle" + cw into cx
put the top of graphic "circle" + ch into cy
put the width of me / 2 into offx
put the height of me / 2 into offy
moveme
end mousedown
on moveme
local dx,dy,ang
put the mouseh - cx into dx
put the mousev - cy into dy
put atan2(dy,dx) into ang
set the left of me to cos(ang) * cw - offx + cx
set the top of me to sin(ang) * ch - offy + cy
if the mouse is down then send moveme to me in 3 ticks
end moveme
More information about the use-livecode
mailing list