flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From OmPrakash Muppirala <bigosma...@gmail.com>
Subject Drawing poly lines with Path API (Was: Re: [FlexJS] Drawing API)
Date Wed, 10 Sep 2014 07:49:34 GMT
On Mon, Sep 8, 2014 at 1:59 PM, Peter Ent <pent@adobe.com> wrote:

>
> Which brings me to the next issue. When drawing a series of connected
> lines (for the LineChart), the first and last points are getting
> connected, which I do not want. My loop to build the path looks like this,
> below. point[0] != point[last] so they should not be connected. I tried
> "z" and "Z" thinking one meant leave the path closed and one closed the
> path, but that didn't make any difference.
>
>                                 var pathString:String = "";
>
>                                 for (var i:int=0; i < points.length; i++) {
>                                     var point:Object = points[i];
>                                         if (i == 0) pathString += "M
> "+point.x+" "+point.y+" ";
>                                         else pathString += "L "+point.x+"
> "+point.y+" ";
>                                 }
>
>                                 pathString += "Z";
>
>                                 path.drawPath(0, 0, pathString);
>
>
>
I just tried it.  The loop gets closed only if there is a fill element.  If
we set only the stroke, the lines draw and end correctly.
I had a bug in GraphicShape where it would not handle null fill or stroke
values.  Now it is fixed.

For example:

                var path1:Path = new Path();
                stroke.color = 0x000000;
                stroke.weight = 1;
                path1.stroke = stroke;

path1.drawPath(50,50,"M50,50L50,100L100,25L45,60L34,23L56,90L50,50Z");
                this.addElement(path1);

draws a series of connected lines; the first and last points are not
connected.

Please let me know if this works for you.

Thanks,
Om

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message