victory-core 36.3.2 → 36.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/victory-core.js +15084 -15018
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +38 -941
- package/es/index.js +19 -28
- package/es/types.d.ts +33 -0
- package/es/types.js +1 -0
- package/es/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/es/victory-accessible-group/victory-accessible-group.js +35 -45
- package/es/victory-animation/util.d.ts +66 -0
- package/es/victory-animation/util.js +3 -2
- package/es/victory-animation/victory-animation.d.ts +69 -0
- package/es/victory-animation/victory-animation.js +92 -102
- package/es/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/es/victory-clip-container/victory-clip-container.js +75 -82
- package/es/victory-container/victory-container.d.ts +99 -0
- package/es/victory-container/victory-container.js +97 -107
- package/es/victory-label/victory-label.d.ts +61 -0
- package/es/victory-label/victory-label.js +43 -31
- package/es/victory-portal/portal-context.d.ts +11 -0
- package/es/victory-portal/portal-context.js +3 -4
- package/es/victory-portal/portal.d.ts +28 -0
- package/es/victory-portal/portal.js +44 -50
- package/es/victory-portal/victory-portal.d.ts +31 -0
- package/es/victory-portal/victory-portal.js +38 -47
- package/es/victory-primitives/arc.d.ts +21 -0
- package/es/victory-primitives/arc.js +9 -9
- package/es/victory-primitives/background.d.ts +22 -0
- package/es/victory-primitives/background.js +12 -12
- package/es/victory-primitives/border.d.ts +18 -0
- package/es/victory-primitives/border.js +9 -9
- package/es/victory-primitives/circle.d.ts +2 -0
- package/es/victory-primitives/circle.js +17 -10
- package/es/victory-primitives/clip-path.d.ts +14 -0
- package/es/victory-primitives/clip-path.js +6 -6
- package/es/victory-primitives/index.d.ts +14 -0
- package/es/victory-primitives/index.js +14 -0
- package/es/victory-primitives/line-segment.d.ts +19 -0
- package/es/victory-primitives/line-segment.js +9 -9
- package/es/victory-primitives/line.d.ts +2 -0
- package/es/victory-primitives/line.js +17 -10
- package/es/victory-primitives/path.d.ts +2 -0
- package/es/victory-primitives/path.js +15 -8
- package/es/victory-primitives/point.d.ts +21 -0
- package/es/victory-primitives/point.js +15 -23
- package/es/victory-primitives/rect.d.ts +2 -0
- package/es/victory-primitives/rect.js +17 -10
- package/es/victory-primitives/text.d.ts +16 -0
- package/es/victory-primitives/text.js +13 -8
- package/es/victory-primitives/tspan.d.ts +2 -0
- package/es/victory-primitives/tspan.js +7 -6
- package/es/victory-primitives/types.d.ts +7 -0
- package/es/victory-primitives/types.js +1 -0
- package/es/victory-primitives/whisker.d.ts +24 -0
- package/es/victory-primitives/whisker.js +12 -12
- package/es/victory-theme/grayscale.d.ts +2 -0
- package/es/victory-theme/grayscale.js +1 -1
- package/es/victory-theme/material.d.ts +2 -0
- package/es/victory-theme/material.js +1 -1
- package/es/victory-theme/victory-theme-definition.d.ts +244 -0
- package/es/victory-theme/victory-theme-definition.js +1 -0
- package/es/victory-theme/victory-theme.d.ts +5 -0
- package/es/victory-theme/victory-theme.js +6 -5
- package/es/victory-transition/victory-transition.d.ts +59 -0
- package/es/victory-transition/victory-transition.js +38 -44
- package/es/victory-util/add-events.js +328 -319
- package/es/victory-util/axis.js +12 -6
- package/es/victory-util/collection.js +7 -5
- package/es/victory-util/common-props.js +2 -2
- package/es/victory-util/data.js +8 -6
- package/es/victory-util/default-transitions.js +0 -1
- package/es/victory-util/domain.js +7 -5
- package/es/victory-util/events.js +8 -4
- package/es/victory-util/helpers.js +1 -3
- package/es/victory-util/hooks/use-animation-state.js +11 -5
- package/es/victory-util/immutable.js +0 -1
- package/es/victory-util/label-helpers.js +0 -2
- package/es/victory-util/line-helpers.js +1 -1
- package/es/victory-util/log.js +0 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -0
- package/es/victory-util/point-path-helpers.js +59 -61
- package/es/victory-util/scale.js +19 -19
- package/es/victory-util/selection.d.ts +23 -0
- package/es/victory-util/selection.js +0 -2
- package/es/victory-util/style.js +0 -2
- package/es/victory-util/textsize.d.ts +8 -0
- package/es/victory-util/textsize.js +11 -7
- package/es/victory-util/timer-context.d.ts +11 -0
- package/es/victory-util/timer-context.js +1 -1
- package/es/victory-util/timer.d.ts +16 -0
- package/es/victory-util/timer.js +16 -13
- package/es/victory-util/types.d.ts +188 -0
- package/es/victory-util/types.js +1 -0
- package/es/victory-util/user-props.js +44 -4
- package/es/victory-util/wrapper.js +18 -12
- package/lib/index.d.ts +38 -941
- package/lib/index.js +201 -189
- package/lib/types.d.ts +33 -0
- package/lib/types.js +1 -0
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +25 -0
- package/lib/victory-accessible-group/victory-accessible-group.js +37 -45
- package/lib/victory-animation/util.d.ts +66 -0
- package/lib/victory-animation/util.js +4 -3
- package/lib/victory-animation/victory-animation.d.ts +69 -0
- package/lib/victory-animation/victory-animation.js +97 -102
- package/lib/victory-clip-container/victory-clip-container.d.ts +76 -0
- package/lib/victory-clip-container/victory-clip-container.js +81 -82
- package/lib/victory-container/victory-container.d.ts +99 -0
- package/lib/victory-container/victory-container.js +102 -107
- package/lib/victory-label/victory-label.d.ts +61 -0
- package/lib/victory-label/victory-label.js +49 -32
- package/lib/victory-portal/portal-context.d.ts +11 -0
- package/lib/victory-portal/portal-context.js +4 -5
- package/lib/victory-portal/portal.d.ts +28 -0
- package/lib/victory-portal/portal.js +49 -50
- package/lib/victory-portal/victory-portal.d.ts +31 -0
- package/lib/victory-portal/victory-portal.js +43 -47
- package/lib/victory-primitives/arc.d.ts +21 -0
- package/lib/victory-primitives/arc.js +13 -10
- package/lib/victory-primitives/background.d.ts +22 -0
- package/lib/victory-primitives/background.js +16 -13
- package/lib/victory-primitives/border.d.ts +18 -0
- package/lib/victory-primitives/border.js +13 -10
- package/lib/victory-primitives/circle.d.ts +2 -0
- package/lib/victory-primitives/circle.js +17 -8
- package/lib/victory-primitives/clip-path.d.ts +14 -0
- package/lib/victory-primitives/clip-path.js +7 -5
- package/lib/victory-primitives/index.d.ts +14 -0
- package/lib/victory-primitives/index.js +187 -0
- package/lib/victory-primitives/line-segment.d.ts +19 -0
- package/lib/victory-primitives/line-segment.js +13 -10
- package/lib/victory-primitives/line.d.ts +2 -0
- package/lib/victory-primitives/line.js +17 -8
- package/lib/victory-primitives/path.d.ts +2 -0
- package/lib/victory-primitives/path.js +15 -6
- package/lib/victory-primitives/point.d.ts +21 -0
- package/lib/victory-primitives/point.js +21 -25
- package/lib/victory-primitives/rect.d.ts +2 -0
- package/lib/victory-primitives/rect.js +17 -8
- package/lib/victory-primitives/text.d.ts +16 -0
- package/lib/victory-primitives/text.js +14 -7
- package/lib/victory-primitives/tspan.d.ts +2 -0
- package/lib/victory-primitives/tspan.js +7 -4
- package/lib/victory-primitives/types.d.ts +7 -0
- package/lib/victory-primitives/types.js +1 -0
- package/lib/victory-primitives/whisker.d.ts +24 -0
- package/lib/victory-primitives/whisker.js +16 -13
- package/lib/victory-theme/grayscale.d.ts +2 -0
- package/lib/victory-theme/grayscale.js +3 -3
- package/lib/victory-theme/material.d.ts +2 -0
- package/lib/victory-theme/material.js +3 -3
- package/lib/victory-theme/victory-theme-definition.d.ts +244 -0
- package/lib/victory-theme/victory-theme-definition.js +1 -0
- package/lib/victory-theme/victory-theme.d.ts +5 -0
- package/lib/victory-theme/victory-theme.js +22 -8
- package/lib/victory-transition/victory-transition.d.ts +59 -0
- package/lib/victory-transition/victory-transition.js +43 -45
- package/lib/victory-util/add-events.js +326 -316
- package/lib/victory-util/axis.js +20 -11
- package/lib/victory-util/collection.js +10 -8
- package/lib/victory-util/common-props.js +6 -4
- package/lib/victory-util/data.js +13 -7
- package/lib/victory-util/default-transitions.js +1 -2
- package/lib/victory-util/domain.js +11 -5
- package/lib/victory-util/events.js +17 -11
- package/lib/victory-util/helpers.js +14 -16
- package/lib/victory-util/hooks/index.js +4 -4
- package/lib/victory-util/hooks/use-animation-state.js +14 -6
- package/lib/victory-util/immutable.js +3 -5
- package/lib/victory-util/label-helpers.js +6 -6
- package/lib/victory-util/line-helpers.js +4 -2
- package/lib/victory-util/log.js +0 -1
- package/lib/victory-util/point-path-helpers.d.ts +9 -0
- package/lib/victory-util/point-path-helpers.js +86 -73
- package/lib/victory-util/prop-types.js +5 -3
- package/lib/victory-util/scale.js +24 -21
- package/lib/victory-util/selection.d.ts +23 -0
- package/lib/victory-util/selection.js +5 -5
- package/lib/victory-util/style.js +0 -2
- package/lib/victory-util/textsize.d.ts +8 -0
- package/lib/victory-util/textsize.js +12 -8
- package/lib/victory-util/timer-context.d.ts +11 -0
- package/lib/victory-util/timer-context.js +1 -1
- package/lib/victory-util/timer.d.ts +16 -0
- package/lib/victory-util/timer.js +16 -13
- package/lib/victory-util/types.d.ts +188 -0
- package/lib/victory-util/types.js +1 -0
- package/lib/victory-util/user-props.js +53 -6
- package/lib/victory-util/wrapper.js +31 -23
- package/package.json +6 -13
- package/src/index.ts +42 -0
- package/src/types.ts +45 -0
- package/src/victory-accessible-group/{victory-accessible-group.js → victory-accessible-group.tsx} +10 -3
- package/src/victory-animation/{util.js → util.ts} +5 -4
- package/src/victory-animation/{victory-animation.js → victory-animation.tsx} +90 -13
- package/src/victory-clip-container/{victory-clip-container.js → victory-clip-container.tsx} +32 -6
- package/src/victory-container/{victory-container.js → victory-container.tsx} +70 -26
- package/src/victory-label/{victory-label.js → victory-label.tsx} +80 -19
- package/src/victory-portal/portal-context.ts +14 -0
- package/src/victory-portal/{portal.js → portal.tsx} +23 -12
- package/src/victory-portal/{victory-portal.js → victory-portal.tsx} +21 -6
- package/src/victory-primitives/{arc.js → arc.tsx} +15 -5
- package/src/victory-primitives/{background.js → background.tsx} +17 -7
- package/src/victory-primitives/{border.js → border.tsx} +12 -5
- package/src/victory-primitives/{circle.js → circle.tsx} +4 -3
- package/src/victory-primitives/clip-path.tsx +25 -0
- package/src/victory-primitives/index.ts +14 -0
- package/src/victory-primitives/{line-segment.js → line-segment.tsx} +13 -5
- package/src/victory-primitives/{line.js → line.tsx} +4 -3
- package/src/victory-primitives/{path.js → path.tsx} +4 -3
- package/src/victory-primitives/{point.js → point.tsx} +25 -20
- package/src/victory-primitives/{rect.js → rect.tsx} +4 -2
- package/src/victory-primitives/{text.js → text.tsx} +9 -3
- package/src/victory-primitives/tspan.tsx +7 -0
- package/src/victory-primitives/types.ts +19 -0
- package/src/victory-primitives/{whisker.js → whisker.tsx} +20 -7
- package/src/victory-theme/{grayscale.js → grayscale.tsx} +2 -1
- package/src/victory-theme/{material.js → material.tsx} +2 -1
- package/src/victory-theme/victory-theme-definition.ts +261 -0
- package/src/victory-theme/victory-theme.tsx +5 -0
- package/src/victory-transition/{victory-transition.js → victory-transition.tsx} +68 -19
- package/src/victory-util/add-events.js +7 -5
- package/src/victory-util/axis.js +3 -1
- package/src/victory-util/collection.js +0 -1
- package/src/victory-util/common-props.js +2 -2
- package/src/victory-util/data.js +0 -1
- package/src/victory-util/default-transitions.js +0 -1
- package/src/victory-util/domain.js +0 -1
- package/src/victory-util/events.js +1 -1
- package/src/victory-util/helpers.js +0 -1
- package/src/victory-util/immutable.js +0 -1
- package/src/victory-util/label-helpers.js +0 -1
- package/src/victory-util/line-helpers.js +1 -1
- package/src/victory-util/log.js +0 -1
- package/src/victory-util/point-path-helpers.ts +119 -0
- package/src/victory-util/prop-types.js +0 -1
- package/src/victory-util/scale.js +18 -10
- package/src/victory-util/selection.d.ts +23 -0
- package/src/victory-util/selection.js +0 -1
- package/src/victory-util/style.js +0 -1
- package/src/victory-util/textsize.d.ts +8 -0
- package/src/victory-util/{timer-context.js → timer-context.ts} +0 -0
- package/src/victory-util/{timer.js → timer.ts} +20 -5
- package/src/victory-util/transitions.js +0 -1
- package/src/victory-util/types.ts +247 -0
- package/src/victory-util/user-props.js +31 -1
- package/src/victory-util/wrapper.js +0 -1
- package/src/index.d.ts +0 -941
- package/src/index.js +0 -51
- package/src/victory-portal/portal-context.js +0 -10
- package/src/victory-primitives/clip-path.js +0 -18
- package/src/victory-primitives/tspan.js +0 -5
- package/src/victory-theme/victory-theme.js +0 -7
- package/src/victory-util/point-path-helpers.js +0 -121
package/src/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// This rule doesn't play well with namespaced exports
|
|
2
|
-
/* eslint-disable import/export */
|
|
3
|
-
export { default as VictoryAccessibleGroup } from "./victory-accessible-group/victory-accessible-group";
|
|
4
|
-
export { default as VictoryAnimation } from "./victory-animation/victory-animation";
|
|
5
|
-
export { default as VictoryContainer } from "./victory-container/victory-container";
|
|
6
|
-
export { default as VictoryLabel } from "./victory-label/victory-label";
|
|
7
|
-
export { default as VictoryTransition } from "./victory-transition/victory-transition";
|
|
8
|
-
export { default as VictoryClipContainer } from "./victory-clip-container/victory-clip-container";
|
|
9
|
-
export { default as VictoryTheme } from "./victory-theme/victory-theme";
|
|
10
|
-
export { default as VictoryPortal } from "./victory-portal/victory-portal";
|
|
11
|
-
export { default as Portal } from "./victory-portal/portal";
|
|
12
|
-
export { default as Arc } from "./victory-primitives/arc";
|
|
13
|
-
export { default as Background } from "./victory-primitives/background";
|
|
14
|
-
export { default as Border, default as Box } from "./victory-primitives/border";
|
|
15
|
-
export { default as Circle } from "./victory-primitives/circle";
|
|
16
|
-
export { default as ClipPath } from "./victory-primitives/clip-path";
|
|
17
|
-
export { default as Line } from "./victory-primitives/line";
|
|
18
|
-
export { default as LineSegment } from "./victory-primitives/line-segment";
|
|
19
|
-
export { default as Path } from "./victory-primitives/path";
|
|
20
|
-
export { default as Point } from "./victory-primitives/point";
|
|
21
|
-
export { default as Rect } from "./victory-primitives/rect";
|
|
22
|
-
export { default as Text } from "./victory-primitives/text";
|
|
23
|
-
export { default as TSpan } from "./victory-primitives/tspan";
|
|
24
|
-
export { default as Whisker } from "./victory-primitives/whisker";
|
|
25
|
-
export { default as addEvents } from "./victory-util/add-events";
|
|
26
|
-
export * as Collection from "./victory-util/collection";
|
|
27
|
-
export * as Data from "./victory-util/data";
|
|
28
|
-
export * as DefaultTransitions from "./victory-util/default-transitions";
|
|
29
|
-
export * as Domain from "./victory-util/domain";
|
|
30
|
-
export * as Events from "./victory-util/events";
|
|
31
|
-
export * as Helpers from "./victory-util/helpers";
|
|
32
|
-
export * as Immutable from "./victory-util/immutable";
|
|
33
|
-
export * as LabelHelpers from "./victory-util/label-helpers";
|
|
34
|
-
export * as Log from "./victory-util/log";
|
|
35
|
-
export * as PropTypes from "./victory-util/prop-types";
|
|
36
|
-
export * as Scale from "./victory-util/scale";
|
|
37
|
-
export * as Selection from "./victory-util/selection";
|
|
38
|
-
export * as Style from "./victory-util/style";
|
|
39
|
-
export * as TextSize from "./victory-util/textsize";
|
|
40
|
-
export { default as Timer } from "./victory-util/timer";
|
|
41
|
-
export * as Transitions from "./victory-util/transitions";
|
|
42
|
-
export * as UserProps from "./victory-util/user-props";
|
|
43
|
-
export * as CommonProps from "./victory-util/common-props";
|
|
44
|
-
export * as Wrapper from "./victory-util/wrapper";
|
|
45
|
-
export * as Axis from "./victory-util/axis";
|
|
46
|
-
export { default as TimerContext } from "./victory-util/timer-context";
|
|
47
|
-
export { default as PortalContext } from "./victory-portal/portal-context";
|
|
48
|
-
export * as Hooks from "./victory-util/hooks";
|
|
49
|
-
export * as LineHelpers from "./victory-util/line-helpers";
|
|
50
|
-
// TODO: Fix this default export
|
|
51
|
-
export { default as PointPathHelpers } from "./victory-util/point-path-helpers";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
|
|
4
|
-
const ClipPath = (props) => (
|
|
5
|
-
<defs>
|
|
6
|
-
<clipPath id={props.clipId}>{props.children}</clipPath>
|
|
7
|
-
</defs>
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
ClipPath.propTypes = {
|
|
11
|
-
children: PropTypes.oneOfType([
|
|
12
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
13
|
-
PropTypes.node
|
|
14
|
-
]),
|
|
15
|
-
clipId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default ClipPath;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/*eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 2.5, 3] }]*/
|
|
2
|
-
import { range } from "lodash";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
circle(x, y, size) {
|
|
6
|
-
return `M ${x}, ${y}
|
|
7
|
-
m ${-size}, 0
|
|
8
|
-
a ${size}, ${size} 0 1,0 ${size * 2},0
|
|
9
|
-
a ${size}, ${size} 0 1,0 ${-size * 2},0`;
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
square(x, y, size) {
|
|
13
|
-
const baseSize = 0.87 * size; // eslint-disable-line no-magic-numbers
|
|
14
|
-
const x0 = x - baseSize;
|
|
15
|
-
const y1 = y + baseSize;
|
|
16
|
-
const distance = x + baseSize - x0;
|
|
17
|
-
return `M ${x0}, ${y1}
|
|
18
|
-
h${distance}
|
|
19
|
-
v-${distance}
|
|
20
|
-
h-${distance}
|
|
21
|
-
z`;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
diamond(x, y, size) {
|
|
25
|
-
const baseSize = 0.87 * size; // eslint-disable-line no-magic-numbers
|
|
26
|
-
const length = Math.sqrt(2 * (baseSize * baseSize));
|
|
27
|
-
return `M ${x}, ${y + length}
|
|
28
|
-
l ${length}, -${length}
|
|
29
|
-
l -${length}, -${length}
|
|
30
|
-
l -${length}, ${length}
|
|
31
|
-
l ${length}, ${length}
|
|
32
|
-
z`;
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
triangleDown(x, y, size) {
|
|
36
|
-
const height = (size / 2) * Math.sqrt(3);
|
|
37
|
-
const x0 = x - size;
|
|
38
|
-
const x1 = x + size;
|
|
39
|
-
const y0 = y - size;
|
|
40
|
-
const y1 = y + height;
|
|
41
|
-
return `M ${x0}, ${y0}
|
|
42
|
-
L ${x1}, ${y0}
|
|
43
|
-
L ${x}, ${y1}
|
|
44
|
-
z`;
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
triangleUp(x, y, size) {
|
|
48
|
-
const height = (size / 2) * Math.sqrt(3);
|
|
49
|
-
const x0 = x - size;
|
|
50
|
-
const x1 = x + size;
|
|
51
|
-
const y0 = y - height;
|
|
52
|
-
const y1 = y + size;
|
|
53
|
-
return `M ${x0}, ${y1}
|
|
54
|
-
L ${x1}, ${y1}
|
|
55
|
-
L ${x}, ${y0}
|
|
56
|
-
z`;
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
plus(x, y, size) {
|
|
60
|
-
const baseSize = 1.1 * size; // eslint-disable-line no-magic-numbers
|
|
61
|
-
const distance = baseSize / 1.5; // eslint-disable-line no-magic-numbers
|
|
62
|
-
return `
|
|
63
|
-
M ${x - distance / 2}, ${y + baseSize}
|
|
64
|
-
v-${distance}
|
|
65
|
-
h-${distance}
|
|
66
|
-
v-${distance}
|
|
67
|
-
h${distance}
|
|
68
|
-
v-${distance}
|
|
69
|
-
h${distance}
|
|
70
|
-
v${distance}
|
|
71
|
-
h${distance}
|
|
72
|
-
v${distance}
|
|
73
|
-
h-${distance}
|
|
74
|
-
v${distance}
|
|
75
|
-
z`;
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
cross(x, y, size) {
|
|
79
|
-
const baseSize = 0.8 * size; // eslint-disable-line no-magic-numbers
|
|
80
|
-
const distance = baseSize / 1.5; // eslint-disable-line no-magic-numbers
|
|
81
|
-
return `
|
|
82
|
-
M ${x - distance / 2}, ${y + baseSize + distance}
|
|
83
|
-
v-${distance * 2}
|
|
84
|
-
h-${distance}
|
|
85
|
-
v-${distance}
|
|
86
|
-
h${distance}
|
|
87
|
-
v-${distance}
|
|
88
|
-
h${distance}
|
|
89
|
-
v${distance}
|
|
90
|
-
h${distance}
|
|
91
|
-
v${distance}
|
|
92
|
-
h-${distance}
|
|
93
|
-
v${distance * 2}
|
|
94
|
-
z`;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
minus(x, y, size) {
|
|
98
|
-
const baseSize = 1.1 * size; // eslint-disable-line no-magic-numbers
|
|
99
|
-
const lineHeight = baseSize - baseSize * 0.3; // eslint-disable-line no-magic-numbers
|
|
100
|
-
const x0 = x - baseSize;
|
|
101
|
-
const y1 = y + lineHeight / 2;
|
|
102
|
-
const distance = x + baseSize - x0;
|
|
103
|
-
return `M ${x0}, ${y1}
|
|
104
|
-
h${distance}
|
|
105
|
-
v-${lineHeight}
|
|
106
|
-
h-${distance}
|
|
107
|
-
z`;
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
star(x, y, size) {
|
|
111
|
-
const baseSize = 1.35 * size; // eslint-disable-line no-magic-numbers
|
|
112
|
-
const angle = Math.PI / 5; // eslint-disable-line no-magic-numbers
|
|
113
|
-
// eslint-disable-next-line no-magic-numbers
|
|
114
|
-
const starCoords = range(10).map((index) => {
|
|
115
|
-
const length = index % 2 === 0 ? baseSize : baseSize / 2;
|
|
116
|
-
return `${length * Math.sin(angle * (index + 1)) + x},
|
|
117
|
-
${length * Math.cos(angle * (index + 1)) + y}`;
|
|
118
|
-
});
|
|
119
|
-
return `M ${starCoords.join("L")} z`;
|
|
120
|
-
}
|
|
121
|
-
};
|