Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _getCircleCfg(coord): CircleCFG {
const { x: rangeX, y: rangeY, isTransposed, circleCenter: center, innerRadius } = coord;
const isReflectY = rangeY.start > rangeY.end;
let start;
if (isTransposed) {
start = { x: isReflectY ? 0 : 1, y: 0 };
} else {
start = { x: 0, y: isReflectY ? 0 : 1 };
}
start = coord.convert(start);
const startVector = [ start.x - center.x, start.y - center.y ];
const normalVector = [ 1, 0 ];
let startAngle;
if (start.y > center.y) {
startAngle = vec2.angle(startVector, normalVector);
} else {
startAngle = vec2.angle(startVector, normalVector) * -1;
}
const endAngle = startAngle + (rangeX.end - rangeX.start);
return {
startAngle,
endAngle,
center,
radius: Math.sqrt(Math.pow(start.x - center.x, 2) + Math.pow(start.y - center.y, 2)),
inner: innerRadius || 0,
};
}
const isReflectY = rangeY.start > rangeY.end;
let start;
if (isTransposed) {
start = { x: isReflectY ? 0 : 1, y: 0 };
} else {
start = { x: 0, y: isReflectY ? 0 : 1 };
}
start = coord.convert(start);
const startVector = [ start.x - center.x, start.y - center.y ];
const normalVector = [ 1, 0 ];
let startAngle;
if (start.y > center.y) {
startAngle = vec2.angle(startVector, normalVector);
} else {
startAngle = vec2.angle(startVector, normalVector) * -1;
}
const endAngle = startAngle + (rangeX.end - rangeX.start);
return {
startAngle,
endAngle,
center,
radius: Math.sqrt(Math.pow(start.x - center.x, 2) + Math.pow(start.y - center.y, 2)),
inner: innerRadius || 0,
};
}