You are not logged in.

perspixe

Trainee

  • "perspixe" started this thread

Posts: 64

Location: Bologna, Italia, Vancouver, BC

  • Send private message

1

Thursday, September 26th 2013, 12:39pm

rotate by dragging

Hello
I wish to rotate a plugin image by dragging.
Would be like using the draglayer() action, but instead of dragging the plugin around, it would stay where it is and rotate on itself depending on the drag, in x or y.
Could not manage to find a way to modify the draglayer() action to do this...
Is there a way, or another way?
Thanks

perspixe

Trainee

  • "perspixe" started this thread

Posts: 64

Location: Bologna, Italia, Vancouver, BC

  • Send private message

2

Thursday, September 26th 2013, 12:52pm

Actually as I was giving up I just found this thread where I found a solution:

on my plugin
ondown="set(dragging,true); dragRot();"
onup="set(dragging,false);"

<action name="dragRot">
if(dragging,
trace(mouse.x,' ',mouse.y);
delayedcall(0,dragRot());
);
</action>

I can use that to set the rotation.

3

Friday, September 27th 2013, 12:42pm

Hi,

you could save the current values of the mouse.x, mouse.y variable in custom variables in the ondown event, and then track the changes in the 'dragRot' action and use them to calculate the rotation in any way...

Here a quick example:
http://krpano.com/krpano.html?xml=examples/dragrotation/dragrotation.xml?html5=prefer

xml:
http://krpano.com/examples/dragrotation/dragrotation.xml

Best regards,
Klaus

4

Wednesday, September 5th 2018, 6:13pm

This is absolutely perfect! Thanks for posting this!!