1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getCircleStyle = exports.VIEW_BOX_SIZE = void 0;
|
7 | var VIEW_BOX_SIZE = exports.VIEW_BOX_SIZE = 100;
|
8 | var getCircleStyle = exports.getCircleStyle = function getCircleStyle(perimeter, perimeterWithoutGap, offset, percent, rotateDeg, gapDegree, gapPosition, strokeColor, strokeLinecap, strokeWidth) {
|
9 | var stepSpace = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : 0;
|
10 | var offsetDeg = offset / 100 * 360 * ((360 - gapDegree) / 360);
|
11 | var positionDeg = gapDegree === 0 ? 0 : {
|
12 | bottom: 0,
|
13 | top: 180,
|
14 | left: 90,
|
15 | right: -90
|
16 | }[gapPosition];
|
17 | var strokeDashoffset = (100 - percent) / 100 * perimeterWithoutGap;
|
18 |
|
19 |
|
20 | if (strokeLinecap === 'round' && percent !== 100) {
|
21 | strokeDashoffset += strokeWidth / 2;
|
22 |
|
23 | if (strokeDashoffset >= perimeterWithoutGap) {
|
24 | strokeDashoffset = perimeterWithoutGap - 0.01;
|
25 | }
|
26 | }
|
27 | var halfSize = VIEW_BOX_SIZE / 2;
|
28 | return {
|
29 | stroke: typeof strokeColor === 'string' ? strokeColor : undefined,
|
30 | strokeDasharray: "".concat(perimeterWithoutGap, "px ").concat(perimeter),
|
31 | strokeDashoffset: strokeDashoffset + stepSpace,
|
32 | transform: "rotate(".concat(rotateDeg + offsetDeg + positionDeg, "deg)"),
|
33 | transformOrigin: "".concat(halfSize, "px ").concat(halfSize, "px"),
|
34 | transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s',
|
35 | fillOpacity: 0
|
36 | };
|
37 | }; |
\ | No newline at end of file |