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

BNig bernd.niggemann at uni-wh.de
Fri Nov 25 08:50:44 CET 2016


Hi,

a "regular polygon" is not a "polygon" which is confusing.

a "polygon" is the type of graphic made of points whereas a "regular
polygon" has no points and are IIRC drawn by the operating system, that is
why they are smooth.

Mark Wieder introduced the "effective points" of any of "rectangle, oval,
roundRect, regular" graphics.

set the points of grc "myRegularPolygon" to the effective points of grc
"myRegularPolygon"

now you have to change the style of the graphic to "polygon" and it uses the
points. If the graphic is not "closed", i.e. the last point is missing then
toggle "opaque" (if on unselect it and reselect it, if off select opaque)
this will close the polygon i.e. it is a full rectangle consisting of 5
points.

The opaque on/off trick also works for polygon graphics you draw in the ide.
If set to opaque it will supply the last point to close the polygon, that
point sticks even if turn opaque off again.

The artifacts regarding "Reshape Graphic" seem to be a regression of the
8.1.2 and up series. In 8.1.1 Stable no artifacts.
http://quality.livecode.com/show_bug.cgi?id=18911

In the 8.1.2 series if you want to get rid of the artifacts choose "Reshape
Graphic" and unselect the graphic. You can now reshape the graphic without
artifacts. It seems that the selection handles are causing the artifacts.

a script to turn rectangle, oval, roundRect and regular graphics into
polygons is here

-------------------------------------
on mouseUp
   put the id of grc 1 into tID
   -- put the id of grc "nameOfGraphic" into tID -- if you use name
   if the style of grc id tID is among the items of
"rectangle,oval,roundRect,regular" then
      put the effective points of grc id tID into tEP
      set the points of grc id tID to tEP
      set the style of grc id tID to "polygon"
      -- close the polygon
      put the opaque of grc id tID into tOpaque
      set the opaque of grc id tID to not the opaque of grc id tID
      set the opaque of grc id tID to not the opaque of grc id tID
      set the opaque of grc id tID to tOpaque
   end if
end mouseUp
--------------------------------


Kind regards
Bernd



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Draw-an-adjustable-Trapezoid-in-Livecode-How-to-change-x-y-of-the-4-corner-points-of-a-rect-tp4710565p4710593.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list