Draw an adjustable Trapezoid in Livecode - How to change x, y of the 4 corner points of a rect

Paul Hibbert paul at livecode.org
Thu Nov 24 16:20:52 EST 2016

> On Nov 24, 2016, at 11:57 AM, Sannyasin Brahmanathaswami <brahma at hindu.org> wrote:
> Question: is there a way to close the polygon path? It does appear to be closed by default, but I can't actually get the last point of the last line to snap-connect to the first point of starting line… maybe that is not doable?  But, mute point since when you switch out the polygon is closed even if you have a small "x over" at the return point… 

You can do this by script, just use something like the following script in the card or stack;
on newGraphic

 — use the altKey to ensure this is a chosen behaviour

 — leave the altKey condition out if this is to be the default behaviour
   if the altKey is down and the style of the last graphic = "polygon" then

      get the points of the last graphic

      put line 1 of it into line -1 of it

      set the points of the last graphic to it

      set the editMode of the last graphic to "polygon" -- Thank you Mark!

   end if

end newGraphic

This will make sure the first point and last point are equal and the graphic points are editable.
  set the editMode of the last graphic to “none” -- turn off the Reshape Polygon mode and remove the edit handles



More information about the Use-livecode mailing list