UNPKG

786 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.reverseCurve = void 0;
4// reverse CURVE based pathArray segments only
5function reverseCurve(pathArray) {
6 var rotatedCurve = pathArray
7 .slice(1)
8 .map(function (x, i, curveOnly) {
9 // @ts-ignore
10 return !i ? pathArray[0].slice(1).concat(x.slice(1)) : curveOnly[i - 1].slice(-2).concat(x.slice(1));
11 })
12 // @ts-ignore
13 .map(function (x) { return x.map(function (y, i) { return x[x.length - i - 2 * (1 - (i % 2))]; }); })
14 .reverse();
15 return [['M'].concat(rotatedCurve[0].slice(0, 2))].concat(rotatedCurve.map(function (x) { return ['C'].concat(x.slice(2)); }));
16}
17exports.reverseCurve = reverseCurve;
18//# sourceMappingURL=reverse-curve.js.map
\No newline at end of file