Say I want to create a rectangle polyline that is closed. I start my line, create lines to each new point, but then how to close? the code I thought would be something like:
newLine.startPath( x, y);
newLine.lineTo(x1, y1) //next coordinate
newLine.lineTo(x2, y2) //etc
newLine.closePathWithLine(); // OR the next line...
console.log("is the new waterway closed? ", newLine.isClosedPath(0))
Both the close path lines of code cause the isClosedPath property to change to true, but the actual polyline is only three sides, the fourth closing line is (as per the documentation below) not a actual line.
A closed path has a virtual segment that connects the last and the first points of the path. The first point is not duplicated to close the path.
I tried adding a line of code at the end to draw a line back to the starting point:
If I include this line WITHOUT any closePath lines of code, it creates a four sided polyline but it is not "closed". If I include this last line of code plus also the code to closePath - it seems to only create three sides again.
How to create a polyline that DOES have all four sides including one back to the start point, but is closed?