const cLen = cPin.length,
first = cPin[0],
last = cPin[cLen - 1];
const calc = requestArray();
let result = ZERO_PATH,
i;
if (closed) {
const startPoint = requestArray();
startPoint.push(...getPathParts(...last, ...first, ...cPin[1], tension));
for (i = 0; i < cLen - 2; i++) {
calc.push(...getPathParts(...cPin[i], ...cPin[i + 1], ...cPin[i + 2], tension));
}
calc.push(...getPathParts(...cPin[cLen - 2], ...last, ...first, tension));
calc.unshift(startPoint[4], startPoint[5]);
calc.push(startPoint[0], startPoint[1], startPoint[2], startPoint[3]);
if (tension) result = buildCurve(first[0], first[1], calc) + 'z';
else result = buildLine(first[0], first[1], calc) + 'z';
releaseArray(startPoint);
}
else {
calc.push(first[0], first[1]);
for (i = 0; i < cLen - 2; i++) {
calc.push(...getPathParts(...cPin[i], ...cPin[i + 1], ...cPin[i + 2], tension));
}
calc.push(last[0], last[1], last[0], last[1]);
if (tension) result = buildCurve(first[0], first[1], calc);
else result = buildLine(first[0], first[1], calc);
}
releaseArray(calc);
return result;
}
return ZERO_PATH;
};
P.calculateLocalPathAdditionalActions = function () {
const [x, y] = this.localBox,
def = this.pathDefinition;
if (this.mapToPins) {
this.set({
start: this.currentPins[0],
});
}
else this.pathDefinition = def.replace(ZERO_PATH, `m${-x},${-y}`);
this.pathCalculatedOnce = false;