Stop Rotation
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Stop Rotation
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?
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
Check the location.. If it is already in the spot, do not rotate it..
Re: Stop Rotation
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
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
wrap it in an if statement
or just set the degrees to rotate to zero..
Code: Select all
if (the location of me <> the location of kTheOtherPolygon) then
revRotatePoly me, 45
end if
Re: Stop Rotation
the command is already in an "if" statement.
But whenever it is clicked it rotates at certain angle.
But whenever it is clicked it rotates at certain angle.
Re: Stop Rotation
Please post your script, guessing is way too timeconsuming!
Re: Stop Rotation
HI Klaus
Here is my script
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
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
How can this be achieved.
Surbhit
Re: Stop Rotation
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!
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
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
and if that was susccessful, you can translate it 1:1 into Livecode almost everytime!
Best
Klaus
Re: Stop Rotation
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
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
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
Hi Shaoesean,
I have already posted my script.
Please check my earlier post in this topic.
Surbhit
I have already posted my script.
Please check my earlier post in this topic.
Surbhit
Re: Stop Rotation
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
Thanks a lot Shaosean.
Will try that.
Surbhit
Will try that.
Surbhit