1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

fixed uploads

This commit is contained in:
muerwre 2019-08-21 18:50:13 +07:00
parent cad4e683bc
commit 32b9a0dbbb
9 changed files with 52 additions and 37 deletions

View file

@ -11,11 +11,11 @@ export const getStyle = (oElm: any, strCssRule: string) => {
};
function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
const angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
return {
x: centerX + (radius * Math.cos(angleInRadians)),
y: centerY + (radius * Math.sin(angleInRadians)),
x: centerX + radius * Math.cos(angleInRadians),
y: centerY + radius * Math.sin(angleInRadians),
};
}
@ -24,7 +24,7 @@ export const describeArc = (
y: number,
radius: number,
startAngle: number = 0,
endAngle: number = 360,
endAngle: number = 360
): string => {
const start = polarToCartesian(x, y, radius, endAngle);
const end = polarToCartesian(x, y, radius, startAngle);
@ -32,9 +32,24 @@ export const describeArc = (
const largeArcFlag = endAngle - startAngle <= 180 ? 0 : 1;
return [
'M', start.x, start.y,
'A', radius, radius, 0, largeArcFlag, 0, end.x, end.y,
'L', x, y,
'L', start.x, start.y,
'M',
start.x,
start.y,
'A',
radius,
radius,
0,
largeArcFlag,
0,
end.x,
end.y,
'L',
x,
y,
'L',
start.x,
start.y,
].join(' ');
};
export const getURL = url => `${process.env.API_HOST}${url}`;