拽动热点
spheretoscreen(ath, atv, hotspotcenterx, hotspotcentery, 'l');
sub(drag_adjustx, mouse.stagex, hotspotcenterx);
sub(drag_adjusty, mouse.stagey, hotspotcentery);
asyncloop(pressed,
sub(dx, mouse.stagex, drag_adjustx);
sub(dy, mouse.stagey, drag_adjusty);
screentosphere(dx, dy, ath, atv);
);
拽动图层
获取x y的位置
copy(drag_currentx, x);
copy(drag_currenty, y);
copy(drag_stagex, mouse.stagex);
copy(drag_stagey, mouse.stagey);
indexoftxt(align_contains_right, get(align), 'right');
indexoftxt(align_contains_bottom, get(align), 'bottom');
calc(drag_align_x, align_contains_right GE 0 ? -1 : +1);
calc(drag_align_y, align_contains_bottom GE 0 ? -1 : +1);
asyncloop(pressed,
calc(x, drag_currentx + (mouse.stagex - drag_stagex)*drag_align_x);
calc(y, drag_currenty + (mouse.stagey - drag_stagey)*drag_align_y);
trace("x ",x," y ",y);
);