Page 1 of 1

How to rotate a graphic line freely?

Posted: Tue May 29, 2007 7:01 am
by alex298
Hello,

I draw a grapic line on a graph. The line need to be able to move and rotate freely on the graph for data analysis.

Move
=======
I can use the following to achieve the result:

on mousedown
grab me
end mousedown

However I have no any idea how to rotate the graphic line. Can RR do that?

Thanks and best regards

Posted: Tue May 29, 2007 11:01 am
by alex298
Hi,

I found that I could layout a button and allowed user to the draw and drag lines freely:

on mouseUp
choose graphic line tool
end mouseUp

When using the Graphic tool, the cursor is a crosshairs. But how to reset the cursor to normal after drawing a line?

Posted: Tue May 29, 2007 11:16 am
by Mark
Hi Alex,

You can use the revRotatePoly command to rotate line graphics:

revrotatepoly the long id of grc id 1003,45

The easiest way to create an interface for rotating objects probably is to use a slider.

I have noticed that rotating line graphics may make the graphic object smaller in size. Also, resetting the rect of the graphic to the original values distorts the rotation. Rotating a graphic is therefore probably not what you want. Try creating a transparent image with equal height and width and a line drawn over it instead. Import the image and use the rotate command to well... rotate it.

Best,

Mark

Posted: Tue May 29, 2007 3:12 pm
by alex298
Hi Mark,

Thanks for your information. I need more time to study your suggested method.

However I found the "choose graphic line tool" quite suitable for my project. The users can draw, move and adjust the line angle freely and easily. The only problem is that I don't know how to reset the cursor to normal after drawing and adjust a line?

Thanks and best regards

Posted: Tue May 29, 2007 3:21 pm
by BvG

Code: Select all

choose browse tool
if it doesn't work (rev is a bit finicky about tools), use a send in time structure:

Code: Select all

--before the end of your handler:
send "changeback" to me in 0.1 seconds

--additional handler:
on changeback
  choose browse tool
end changeback

Posted: Wed May 30, 2007 4:44 am
by alex298
Hi BvG,

Thanks for your help. But I don't know where to add the codes.

There is a button "Line Tool" and a graphic "Graph" on the card. When I click on the button "Line Tool", the mouse cursor change to a crosshair. Then I draw a new line on the graphic "Graph". I need to change the cursor to browse cursor when I satisfy with location and position of the new line.

Thanks and best regards

Posted: Wed May 30, 2007 7:40 am
by Mark
Hi Alex,

Why don't you make a tools palette, just like Revolution? A palette will allow you to click buttons to choose a different tool, regardless of what the currently chosen tool is.

Best,

Mark

Posted: Wed May 30, 2007 7:53 am
by alex298
Hi Mark,

This is a very good idea. Any project examples of Tool Palette that can download to my computer and study?