Reversing the end point arrow

Jim Hurley jhurley0305 at sbcglobal.net
Sat Dec 8 15:33:42 EST 2012


In RR the start arrow and the end arrow point away from each other.

I needed a line with the more traditional arrows, both pointing in the same direction along the line.
The following handler  will reverse the direction of the start arrow.
It does so by introducing a third point ON THE LINE between the two original point. It is locate  just a SHORT distance (ds) up from the original start point.
The end arrow will now point from this new intermediate point, to the original start point, thus, effectively, revering the direction.

on mouseUp
   put "myLine" into tName --Name of the line
   set the endArrow of grc tName to true
   set the startArrow of grc tName to True
   set the arrowsize of grc tName to 6
   put the points of grc tName into tPoints
   put line 1 of tPoints into tStart
   put line 2 of tPoints into tEnd
   put item 1 of tEnd - item 1 of tStart into dx
   put  item 2 of tEnd - item 2 of tStart into dy
   --Now create a new end point.
   --It will be just a short distance (ds) up from the original end point.
   put 2 into ds
    put atan2(dy,dx) into tAngle
   put ds * cos(tAngle) into dx
   put ds * sin(tAngle) into dy
   add round(dx) to item 1 of tStart
   add Round(dy) to item 2 of tStart
   --Insert this new end point into the line's points
   put tStart & cr & tPoints into tNewPoints
   set the points of grc tName to tNewPoints
end mouseUp





More information about the use-livecode mailing list