let cLen = cPin.length,
first = cPin[0],
last = cPin[cLen - 1],
calc = [],
result = 'm0,0';
if (closed) {
let startPoint = [].concat(...getPathParts(...last, ...first, ...cPin[1], tension));
for (let i = 0; i < cLen - 2; i++) {
calc = calc.concat(...getPathParts(...cPin[i], ...cPin[i + 1], ...cPin[i + 2], tension));
}
calc = calc.concat(...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';
}
else {
calc.push(first[0], first[1]);
for (let i = 0; i < cLen - 2; i++) {
calc = calc.concat(...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);
}
return result;
}
return 'm0,0';
};
P.calculateLocalPathAdditionalActions = function () {
let [x, y, w, h] = this.localBox,
def = this.pathDefinition;
if (this.mapToPins) {
this.set({
start: this.currentPins[0],
});
}
else this.pathDefinition = def.replace('m0,0', `m${-x},${-y}`);
this.pathCalculatedOnce = false;