1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<action name="dragrotation_hs">
<!-- backup current align/edge settings -->
copy(backup_align, align);
copy(backup_edge, edge);
<!-- change the origin to lefttop to get coordinates relative to the mouse -->
changeorigin(lefttop,center);
//adapting code for hotspots...
copy(hsath, hotspot[get(name)].ath);
copy(hsatv, hotspot[get(name)].atv);
spheretoscreen(hsath,hsatv,xath,yatv);
copy(mx, xath);
copy(my, yatv);
// end adapting
<!-- restore the align/edge settings -->
changeorigin(get(backup_align),get(backup_edge));
<!-- calc the start rotation -->
sub(dx, mx, mouse.stagex);
sub(dy, my, mouse.stagey);
Math.atan2(r, dx, dy);
div(r, Math.PI);
mul(r, 180.0);
add(sr, rotate, r);
<!-- loop as long as the mouse button is pressed and rotate the image -->
asyncloop(pressed,
sub(dx, mx, mouse.stagex);
sub(dy, my, mouse.stagey);
Math.atan2(r, dx, dy);
div(r, Math.PI);
mul(r, 180.0);
sub(rotate, sr, r);
);
</action>
|