I am trying to draw an arc that may alter in radius. I have the arc drawing routine worked out and it works fine. However, as the radius increases the rect on which the arc is drawn increases in size to the point that the x coordinate of the top left point goes negative. The rect then starts shifting to the right. The consequence of this is that the arc starts to move to the right.
It seems logical that one would not try to draw a graphic beyond the edge of the card but in this case the rect only simply defines the arc. What is the simplest way to deal with this issue?
Negative coordinate for template graphic
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Try saving the 'location' of the arc graphic before changing the radius, and then setting the location to this saved value afterwards.
Jan Schenkel.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
If I save the "Location" I will save both the x coordinate and y coordinate. The y coordinate varies with the radius. What I need to do is keep the x coordinate constant. What syntax should I be using to save and restore the x coordinate alone? The dictionary doesn't give much of a clue and my attempts to deduce the syntax from the dictionary throw up error messages.
Alistair,
if I understand correctly what you are doing you might try
put item 1 of the loc of graphic "mygraphic" into tdistanceXfromLeftBorder
change your y of the graphic
put the loc of graphic "mygraphic" into tnewLoc
put tdistanceXfromLeftBorder into item 1 of tnewLoc
set the loc of graphic "mygraphic" to tnewLoc
this will set the location of the changed graphic to the same distance from the left border as the original graphic.
If this is not it then you might want to post some of the pertaining code so it is easier to see what exactly you have in mind
regards
bernd
if I understand correctly what you are doing you might try
put item 1 of the loc of graphic "mygraphic" into tdistanceXfromLeftBorder
change your y of the graphic
put the loc of graphic "mygraphic" into tnewLoc
put tdistanceXfromLeftBorder into item 1 of tnewLoc
set the loc of graphic "mygraphic" to tnewLoc
this will set the location of the changed graphic to the same distance from the left border as the original graphic.
If this is not it then you might want to post some of the pertaining code so it is easier to see what exactly you have in mind
regards
bernd