P.makeStarPath = function () {
const points = this.points,
twist = this.twist,
turn = 360 / points;
let radius1 = this.radius1,
radius2 = this.radius2;
let currentX, currentY, x, y,
myPath = ZERO_STR;
if (radius1.substring || radius2.substring) {
const host = this.getHost();
if (host) {
const hW = host.currentDimensions[0];
radius1 = (radius1.substring) ? (parseFloat(radius1) / 100) * hW : radius1;
radius2 = (radius2.substring) ? (parseFloat(radius2) / 100) * hW : radius2;
}
}
const v1 = requestVector({x: 0, y: -radius1}),
v2 = requestVector({x: 0, y: -radius2});
currentX = v1.x;
currentY = v1.y;
v2.rotate(-turn/2);
v2.rotate(twist);
for (let i = 0; i < points; i++) {
v2.rotate(turn);
x = parseFloat((v2.x - currentX).toFixed(1));
currentX += x;
y = parseFloat((v2.y - currentY).toFixed(1));
currentY += y;
myPath += `${x},${y} `;
v1.rotate(turn);
x = parseFloat((v1.x - currentX).toFixed(1));
currentX += x;
y = parseFloat((v1.y - currentY).toFixed(1));
currentY += y;
myPath += `${x},${y} `;
}
releaseVector(v1, v2);
return `${ZERO_PATH}l${myPath}z`;
};
P.calculateLocalPathAdditionalActions = function () {
let scale = this.scale;
if (scale < 0.001) scale = 0.001;
const [x, y] = this.localBox;
this.pathDefinition = this.pathDefinition.replace(ZERO_PATH, `m${-x / scale},${-y / scale}`);
this.pathCalculatedOnce = false;