Page 1 of 1
Stop Rotation
Posted: Mon Aug 27, 2012 10:23 am
by Surbhit29
I have used revRotatePoly under mouseUp. So whenever I drag the polygon to a particular location and drop it at that location, it will rotate to a desired angle. So far no problem.
Now problem arises when that particular polygon is clicked by me. Whenever it is clicked it rotates to that particular angle. Now is their anyway to stop this rotation whenever it is clicked. I want the polygon to rotate only when it is dragged and dropped at the desired position.
How can that be done? Is their any different handler that I should be using?
Re: Stop Rotation
Posted: Tue Aug 28, 2012 1:21 am
by shaosean
Check the location.. If it is already in the spot, do not rotate it..
Re: Stop Rotation
Posted: Tue Aug 28, 2012 6:33 am
by Surbhit29
Hi Shaosean
I've been trying that but cannot find the right command. I've searched dictionary, user guide, forum everywhere. Is their any command like "Stop revRotatePoly"?
Surbhit
Re: Stop Rotation
Posted: Tue Aug 28, 2012 10:24 am
by shaosean
wrap it in an if statement
Code: Select all
if (the location of me <> the location of kTheOtherPolygon) then
revRotatePoly me, 45
end if
or just set the degrees to rotate to zero..
Re: Stop Rotation
Posted: Tue Aug 28, 2012 11:22 am
by Surbhit29
the command is already in an "if" statement.
But whenever it is clicked it rotates at certain angle.
Re: Stop Rotation
Posted: Tue Aug 28, 2012 12:32 pm
by Klaus
Please post your script, guessing is way too timeconsuming!
Re: Stop Rotation
Posted: Tue Aug 28, 2012 12:50 pm
by Surbhit29
HI Klaus
Here is my script
Code: Select all
on mouseUp
if within (graphic "Rectangle", the mouseloc) then
revRotatePoly the long ID of graphic "outerPoly",45
end if
end mouseUp
Its fine when an object is dragged from one place into "Rectangle" and it gets rotated by an angle 45. But when an object is dragged inside the rectangle and is left there only it should not rotate.
How can this be achieved.
Surbhit
Re: Stop Rotation
Posted: Tue Aug 28, 2012 1:33 pm
by Klaus
Your script does not cover your condition!?
You only check if the current mouseloc (sic!) is within the graphic "Rectangle"
but you wanted to check some other condition as Sean showed in her script!
Pseudocode, do not copy/paste!
Code: Select all
on mouseUp
if within (graphic "Rectangle", the mouseloc) AND (the loc grc "outerpoly" is NOT "where it should be") the then
revRotatePoly the long ID of graphic "outerPoly",45
end if
end mouseUp
Please do not think too much in "computer" terms, try to explain and solve the logics of your problem to yourself in plain english
and if that was susccessful, you can translate it 1:1 into Livecode almost everytime!
Best
Klaus
Re: Stop Rotation
Posted: Wed Aug 29, 2012 5:49 am
by Surbhit29
Hi Klaus,
Its giving me the same result. I want that once the polygon is inside the rectangle no matter how much time we click it or drag inside that rectangle it should not rotate.
Because whenever we click it or drag it inside the rectangle it will keep on rotating because of the mouseUp handler.
Surbhit
Re: Stop Rotation
Posted: Wed Aug 29, 2012 6:01 am
by shaosean
Best to post the code you are using so we can help that way, otherwise, the advice above is what you need to do..
Re: Stop Rotation
Posted: Wed Aug 29, 2012 6:34 am
by Surbhit29
Hi Shaoesean,
I have already posted my script.
Please check my earlier post in this topic.
Surbhit
Re: Stop Rotation
Posted: Wed Aug 29, 2012 6:48 am
by shaosean
ahh.. missed that.. looks like you will need to set a flag to control it.. you can either use a script-wide variable or a custom property on the object and then check that..
Code: Select all
local sRotateFlag // this will default to false
on mouseUp
if within (graphic "Rectangle", the mouseloc) AND (sRotateFlag = FALSE) then
revRotatePoly the long ID of graphic "outerPoly",45
put FALSE into sRotateFlag
end if
end mouseUp
Re: Stop Rotation
Posted: Thu Aug 30, 2012 1:54 pm
by Surbhit29
Thanks a lot Shaosean.
Will try that.
Surbhit