Page 1 of 1
Negative coordinate for template graphic
Posted: Wed Sep 17, 2008 2:54 am
by Alistair
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?
Posted: Wed Sep 17, 2008 12:28 pm
by Janschenkel
Try saving the 'location' of the arc graphic before changing the radius, and then setting the location to this saved value afterwards.
Jan Schenkel.
Posted: Thu Sep 18, 2008 7:22 am
by Alistair
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.
Posted: Thu Sep 18, 2008 8:21 am
by Klaus
Hi Alistair,
maybe saving and restoring "the topleft of grc XYZ" helps?
Posted: Thu Sep 18, 2008 9:57 am
by bn
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