TypeError: this.ParseFirstLeft is not a function
Boolean operations and offsetting library in Javascript
Brought to you by:
timo23414
Running the following code
var CLIPPER = new ClipperLib.Clipper(); var shapeA = [ [{ X: 647, Y: 1372 }, { X: 350, Y: 1204 }, { X: 27, Y: 1014 }, { X: 27, Y: 104 }, { X: 647, Y: 75 }] ]; var shapeB = [ [{ X: 525, Y: 1303 }, { X: 350, Y: 1204 }, { X: 27, Y: 1014 }, { X: 27, Y: 1010 }], // [{ X: 647, Y: 913 }, { X: 647, Y: 967 }, { X: 595, Y: 944 }, { X: 602, Y: 911 }], [{ X: 647, Y: 88 }, { X: 27, Y: 118 }, { X: 27, Y: 104 }, { X: 647, Y: 75 }] ]; var solution = new ClipperLib.PolyTree(); CLIPPER.AddPaths(shapeA, ClipperLib.PolyType.ptSubject, true); CLIPPER.AddPaths(shapeB, ClipperLib.PolyType.ptClip, true); CLIPPER.Execute(ClipperLib.ClipType.ctDifference, solution); var newShape = ClipperLib.Clipper.PolyTreeToPaths(solution);
Results in the following error
var firstLeft = this.ParseFirstLeft(outRec.FirstLeft); ^ TypeError: this.ParseFirstLeft is not a function
This happend when I switched from Clipper v6.1.3 to v6.2.1.2.
I have found a possible solution. When I change line 5614 from
var firstLeft = this.ParseFirstLeft(outRec.FirstLeft);
to
var firstLeft = ClipperLib.Clipper.ParseFirstLeft(outRec.FirstLeft);
it runs perfectly
Thanks for reporting. This will be fixed in upcoming 6.4.2.1.