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

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami
I want to be able to draw an adjustable trapezoid in Livecode.

The regular polygon tool set to 4 sides doesn't allow you  to grab any given

Similarly, the polygon graphic also doesn't provide grab points for corners of a rect that you can drag and adjust

Is this just impossible? or am I missing something?

I could live with the option to set the four points of the graphic such that 4 straight lines are connected but the corners placed where I want them… a bit above my brain pay grade at the moment. of course you could set *all* of the points of the graphic but I'd like just to be able to set the points of the 4 corners of the rect/trapezoid

is this even doable?

BR

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Paul_Hibbert

> On Nov 23, 2016, at 8:44 PM, Sannyasin Brahmanathaswami <[hidden email]> wrote:
>
> is this even doable?


The good news:
Right click on the Polygon then choose 'Reshape Polygon' and the points that you require should appear. :-)

Now the bad news:
Sadly this also revealed the ghost trails seen before when you start to drag the points around. :-(

Paul

Mac OS X 10.12.1 - LC8.1.2. (rc 2)
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami

    The good news:
    Right click on the Polygon then choose 'Reshape Polygon' and the points that you require should appear. :-)

BR: confirmed.. that works.

    Now the bad news:
    Sadly this also revealed the ghost trails seen before when you start to drag the points around. :-(
 
BR: oops, right, old bug is back…

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…

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Mark Waddingham-2
In reply to this post by Sannyasin Brahmanathaswami
Check out the editMode property of graphic objects.

Warmest regards,

Mark.

Sent from my iPhone

> On 24 Nov 2016, at 04:44, Sannyasin Brahmanathaswami <[hidden email]> wrote:
>
> I want to be able to draw an adjustable trapezoid in Livecode.
>
> The regular polygon tool set to 4 sides doesn't allow you  to grab any given
>
> Similarly, the polygon graphic also doesn't provide grab points for corners of a rect that you can drag and adjust
>
> Is this just impossible? or am I missing something?
>
> I could live with the option to set the four points of the graphic such that 4 straight lines are connected but the corners placed where I want them… a bit above my brain pay grade at the moment. of course you could set *all* of the points of the graphic but I'd like just to be able to set the points of the 4 corners of the rect/trapezoid
>
> is this even doable?
>
> BR
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

RogGuay
In reply to this post by Sannyasin Brahmanathaswami
I don’t know about you, but I got tired trying to figure out how to use the editMode of a polygon in Version 8, so I built what I think you need here:

https://www.dropbox.com/s/bbsfkorg9vm32um/PolywHandles.livecode?dl=0 <https://www.dropbox.com/s/bbsfkorg9vm32um/PolywHandles.livecode?dl=0>


Cheers,

Roger



> On Nov 24, 2016, at 11:57 AM, Sannyasin Brahmanathaswami <[hidden email]> wrote:
>
>
>    The good news:
>    Right click on the Polygon then choose 'Reshape Polygon' and the points that you require should appear. :-)
>
> BR: confirmed.. that works.
>
>    Now the bad news:
>    Sadly this also revealed the ghost trails seen before when you start to drag the points around. :-(
>
> BR: oops, right, old bug is back…
>
> 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…
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Paul_Hibbert
In reply to this post by Sannyasin Brahmanathaswami

> On Nov 24, 2016, at 11:57 AM, Sannyasin Brahmanathaswami <[hidden email]> 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

Regards,

Paul
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami
In reply to this post by Mark Waddingham-2
Thanks every one for all the great answers/ideas.

That said,

@Mark… docs may need clarification

1) create 'regular polygon graphic" with 4 sides
2) name it "trapezoid"
3) make button "set the editMode of grc "trapezoid" to polygon

result: nothing happens at all, no change, no option to add  or "touch" any points. So perhaps "edit mode of graphics" needs to be "editMode of graphics with style set to "Polygon"

and not "regular"

@Alejandro:  Awesome simple little script!

BR

 

On 11/24/16, 10:01 AM, "use-livecode on behalf of Mark Waddingham" <[hidden email] on behalf of [hidden email]> wrote:

    Check out the editMode property of graphic objects.
   
    Warmest regards,
   
    Mark.
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

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

BNig
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
Reply | Threaded
Open this post in threaded view
|

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

Sannyasin Brahmanathaswami
Bernd

Thanks for the patience in clarifying all this.

I think the dictionary could really use some kind of  commenting system. What you are saying here is really important both for future docs as well as possible changes in the terms used in the IDE.  But.. here it is buried deep in the lists.

Opaque on/off trick… wow… very helpful.. typically I will be following a path in an image. Kind of like the magnetic lasso operation in photoshop, the use case is to use the graphic as a mask, set blending, gradient over an area of the image…

So once we get to the last point before closing… instead of going on that mini-frustrating fishing expedition to try to make the last point on top of the first one… we can just stop .. toggle opacity and let LC do it for us… very useful hint!

BR

On 11/24/16, 9:50 PM, "use-livecode on behalf of BNig" <[hidden email] on behalf of [hidden email]> wrote:

    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.
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode