Hi,
Solved from adapting the Klaus solution to rotate layer: (Thanks Klaus! )
Code
<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>
Display More
Example of use:
Code
<hotspot name="hs_spot1" sedge="center" align="center" rotate="0" ath="0.175" atv="0.072" ondown="dragrotation_hs"/>
Original Klaus solution for rotate layer: https://krpano.com/forum/wbb/inde…49139#post49139
Best regards,
Fernando