@mui/x-charts-pro 8.2.0 → 8.3.1

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.
Files changed (154) hide show
  1. package/BarChartPro/BarChartPro.d.ts +7 -1
  2. package/BarChartPro/BarChartPro.js +60 -4
  3. package/CHANGELOG.md +199 -6
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  5. package/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
  6. package/ChartZoomSlider/ChartZoomSlider.js +47 -0
  7. package/ChartZoomSlider/index.d.ts +2 -0
  8. package/ChartZoomSlider/index.js +27 -0
  9. package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
  10. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +348 -0
  11. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
  12. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +92 -0
  13. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
  14. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +27 -0
  15. package/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
  16. package/ChartsToolbarPro/ChartsToolbarPro.js +31 -0
  17. package/ChartsToolbarPro/index.d.ts +1 -0
  18. package/ChartsToolbarPro/index.js +16 -0
  19. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
  20. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +36 -0
  21. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
  22. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +36 -0
  23. package/FunnelChart/FunnelChart.js +2 -7
  24. package/FunnelChart/FunnelPlot.js +24 -3
  25. package/FunnelChart/FunnelSection.d.ts +1 -0
  26. package/FunnelChart/FunnelSection.js +12 -7
  27. package/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
  28. package/FunnelChart/curves/borderRadiusPolygon.js +42 -0
  29. package/FunnelChart/curves/bump.d.ts +8 -5
  30. package/FunnelChart/curves/bump.js +21 -22
  31. package/FunnelChart/curves/curve.types.d.ts +33 -3
  32. package/FunnelChart/curves/getFunnelCurve.d.ts +2 -2
  33. package/FunnelChart/curves/getFunnelCurve.js +12 -4
  34. package/FunnelChart/curves/linear.d.ts +17 -9
  35. package/FunnelChart/curves/linear.js +62 -87
  36. package/FunnelChart/curves/pyramid.d.ts +34 -0
  37. package/FunnelChart/curves/pyramid.js +127 -0
  38. package/FunnelChart/curves/step-pyramid.d.ts +31 -0
  39. package/FunnelChart/curves/step-pyramid.js +107 -0
  40. package/FunnelChart/curves/step.d.ts +32 -0
  41. package/FunnelChart/curves/step.js +88 -0
  42. package/FunnelChart/curves/utils.d.ts +4 -0
  43. package/FunnelChart/curves/utils.js +29 -0
  44. package/FunnelChart/funnel.types.d.ts +23 -2
  45. package/FunnelChart/funnelSectionClasses.d.ts +5 -1
  46. package/FunnelChart/funnelSectionClasses.js +5 -2
  47. package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
  48. package/FunnelChart/useFunnelChartProps.d.ts +0 -5
  49. package/FunnelChart/useFunnelChartProps.js +0 -11
  50. package/Heatmap/Heatmap.d.ts +3 -3
  51. package/Heatmap/Heatmap.js +2 -20
  52. package/LineChartPro/LineChartPro.d.ts +7 -1
  53. package/LineChartPro/LineChartPro.js +60 -4
  54. package/ScatterChartPro/ScatterChartPro.d.ts +7 -1
  55. package/ScatterChartPro/ScatterChartPro.js +60 -4
  56. package/esm/BarChartPro/BarChartPro.d.ts +7 -1
  57. package/esm/BarChartPro/BarChartPro.js +60 -4
  58. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  59. package/esm/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
  60. package/esm/ChartZoomSlider/ChartZoomSlider.js +41 -0
  61. package/esm/ChartZoomSlider/index.d.ts +2 -0
  62. package/esm/ChartZoomSlider/index.js +2 -0
  63. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
  64. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +339 -0
  65. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
  66. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +85 -0
  67. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
  68. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +17 -0
  69. package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
  70. package/esm/ChartsToolbarPro/ChartsToolbarPro.js +24 -0
  71. package/esm/ChartsToolbarPro/index.d.ts +1 -0
  72. package/esm/ChartsToolbarPro/index.js +1 -0
  73. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
  74. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +29 -0
  75. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
  76. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +29 -0
  77. package/esm/FunnelChart/FunnelChart.js +2 -7
  78. package/esm/FunnelChart/FunnelPlot.js +24 -3
  79. package/esm/FunnelChart/FunnelSection.d.ts +1 -0
  80. package/esm/FunnelChart/FunnelSection.js +12 -7
  81. package/esm/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
  82. package/esm/FunnelChart/curves/borderRadiusPolygon.js +36 -0
  83. package/esm/FunnelChart/curves/bump.d.ts +8 -5
  84. package/esm/FunnelChart/curves/bump.js +21 -22
  85. package/esm/FunnelChart/curves/curve.types.d.ts +33 -3
  86. package/esm/FunnelChart/curves/getFunnelCurve.d.ts +2 -2
  87. package/esm/FunnelChart/curves/getFunnelCurve.js +12 -4
  88. package/esm/FunnelChart/curves/linear.d.ts +17 -9
  89. package/esm/FunnelChart/curves/linear.js +62 -86
  90. package/esm/FunnelChart/curves/pyramid.d.ts +34 -0
  91. package/esm/FunnelChart/curves/pyramid.js +121 -0
  92. package/esm/FunnelChart/curves/step-pyramid.d.ts +31 -0
  93. package/esm/FunnelChart/curves/step-pyramid.js +101 -0
  94. package/esm/FunnelChart/curves/step.d.ts +32 -0
  95. package/esm/FunnelChart/curves/step.js +82 -0
  96. package/esm/FunnelChart/curves/utils.d.ts +4 -0
  97. package/esm/FunnelChart/curves/utils.js +19 -0
  98. package/esm/FunnelChart/funnel.types.d.ts +23 -2
  99. package/esm/FunnelChart/funnelSectionClasses.d.ts +5 -1
  100. package/esm/FunnelChart/funnelSectionClasses.js +5 -2
  101. package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
  102. package/esm/FunnelChart/useFunnelChartProps.d.ts +0 -5
  103. package/esm/FunnelChart/useFunnelChartProps.js +0 -11
  104. package/esm/Heatmap/Heatmap.d.ts +3 -3
  105. package/esm/Heatmap/Heatmap.js +2 -20
  106. package/esm/LineChartPro/LineChartPro.d.ts +7 -1
  107. package/esm/LineChartPro/LineChartPro.js +60 -4
  108. package/esm/ScatterChartPro/ScatterChartPro.d.ts +7 -1
  109. package/esm/ScatterChartPro/ScatterChartPro.js +60 -4
  110. package/esm/index.d.ts +4 -1
  111. package/esm/index.js +4 -3
  112. package/esm/internals/material/icons.d.ts +3 -0
  113. package/esm/internals/material/icons.js +13 -0
  114. package/esm/internals/material/index.d.ts +4 -0
  115. package/esm/internals/material/index.js +12 -0
  116. package/esm/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
  117. package/esm/internals/plugins/useChartProZoom/calculateZoom.js +32 -0
  118. package/esm/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
  119. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +45 -3
  120. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +63 -11
  121. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
  122. package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
  123. package/esm/internals/slots/chartBaseSlotProps.d.ts +10 -0
  124. package/esm/internals/slots/chartBaseSlotProps.js +1 -0
  125. package/esm/internals/slots/chartsBaseSlots.d.ts +6 -0
  126. package/esm/internals/slots/chartsBaseSlots.js +1 -0
  127. package/esm/internals/slots/chartsIconSlots.d.ts +14 -0
  128. package/esm/internals/slots/chartsIconSlots.js +1 -0
  129. package/esm/typeOverloads/modules.d.ts +1 -1
  130. package/index.d.ts +4 -1
  131. package/index.js +23 -1
  132. package/internals/material/icons.d.ts +3 -0
  133. package/internals/material/icons.js +20 -0
  134. package/internals/material/index.d.ts +4 -0
  135. package/internals/material/index.js +19 -0
  136. package/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
  137. package/internals/plugins/useChartProZoom/calculateZoom.js +39 -0
  138. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
  139. package/internals/plugins/useChartProZoom/useChartProZoom.js +44 -2
  140. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +63 -11
  141. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
  142. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
  143. package/internals/slots/chartBaseSlotProps.d.ts +10 -0
  144. package/internals/slots/chartBaseSlotProps.js +5 -0
  145. package/internals/slots/chartsBaseSlots.d.ts +6 -0
  146. package/internals/slots/chartsBaseSlots.js +5 -0
  147. package/internals/slots/chartsIconSlots.d.ts +14 -0
  148. package/internals/slots/chartsIconSlots.js +5 -0
  149. package/package.json +7 -7
  150. package/typeOverloads/modules.d.ts +1 -1
  151. package/FunnelChart/curves/funnelStep.d.ts +0 -25
  152. package/FunnelChart/curves/funnelStep.js +0 -87
  153. package/esm/FunnelChart/curves/funnelStep.d.ts +0 -25
  154. package/esm/FunnelChart/curves/funnelStep.js +0 -80
@@ -1,4 +1,4 @@
1
- import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData } from '@mui/x-charts/internals';
1
+ import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData, AxisId } from '@mui/x-charts/internals';
2
2
  export interface UseChartProZoomParameters {
3
3
  /**
4
4
  * The list of zoom data related to each axis.
@@ -42,7 +42,22 @@ export interface UseChartProZoomPublicApi {
42
42
  */
43
43
  setZoomData: (value: ZoomData[] | ((prev: ZoomData[]) => ZoomData[])) => void;
44
44
  }
45
- export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {}
45
+ export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {
46
+ /**
47
+ * Translate the zoom range (i.e., both start and end) for a specific axis.
48
+ * @param {AxisId} axisId The id of the axis to move the zoom range for.
49
+ * @param {number} by The amount to move the zoom range by. Ranges from 0 to 100.
50
+ */
51
+ moveZoomRange: (axisId: AxisId, by: number) => void;
52
+ /**
53
+ * Zoom in the chart.
54
+ */
55
+ zoomIn: () => void;
56
+ /**
57
+ * Zoom out the chart.
58
+ */
59
+ zoomOut: () => void;
60
+ }
46
61
  export type UseChartProZoomSignature = ChartPluginSignature<{
47
62
  params: UseChartProZoomParameters;
48
63
  defaultizedParams: UseChartProZoomDefaultizedParameters;
@@ -0,0 +1,10 @@
1
+ import type * as React from 'react';
2
+ import { ChartBaseCommonProps } from '@mui/x-charts/models';
3
+ export type ChartBaseTooltipProps = ChartBaseCommonProps & {
4
+ children: React.ReactElement<any, any>;
5
+ enterDelay?: number;
6
+ title: React.ReactNode;
7
+ };
8
+ export type ChartBaseIconButtonProps = ChartBaseCommonProps & {
9
+ ref?: React.Ref<HTMLButtonElement>;
10
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,6 @@
1
+ import { ChartsBaseSlots } from '@mui/x-charts/models';
2
+ import * as React from 'react';
3
+ import { ChartBaseTooltipProps } from "./chartBaseSlotProps.js";
4
+ export interface ChartsBaseSlotsPro extends ChartsBaseSlots {
5
+ baseTooltip: React.ComponentType<ChartBaseTooltipProps>;
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import { ChartBaseIconProps, ChartsIconSlots } from '@mui/x-charts/models';
3
+ export interface ChartsIconSlotsPro extends ChartsIconSlots {
4
+ /**
5
+ * Icon displayed on the toolbar's zoom in button.
6
+ * @default ChartsZoomInIcon
7
+ */
8
+ zoomInIcon: React.ComponentType<ChartBaseIconProps>;
9
+ /**
10
+ * Icon displayed on the toolbar's zoom out button.
11
+ * @default ChartsZoomOutIcon
12
+ */
13
+ zoomOutIcon: React.ComponentType<ChartBaseIconProps>;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@mui/x-charts-pro",
3
- "version": "8.2.0",
4
- "description": "The Pro plan edition of the Charts components (MUI X).",
3
+ "version": "8.3.1",
5
4
  "author": "MUI Team",
5
+ "description": "The Pro plan edition of the MUI X Charts components.",
6
6
  "main": "./index.js",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "bugs": {
@@ -29,14 +29,14 @@
29
29
  "directory": "packages/x-charts-pro"
30
30
  },
31
31
  "dependencies": {
32
- "@babel/runtime": "^7.27.0",
32
+ "@babel/runtime": "^7.27.1",
33
33
  "@mui/utils": "^7.0.2",
34
34
  "clsx": "^2.1.1",
35
35
  "prop-types": "^15.8.1",
36
- "@mui/x-charts": "8.2.0",
37
- "@mui/x-internals": "8.2.0",
38
- "@mui/x-charts-vendor": "8.0.0",
39
- "@mui/x-license": "8.2.0"
36
+ "@mui/x-internals": "8.3.1",
37
+ "@mui/x-charts-vendor": "8.3.1",
38
+ "@mui/x-license": "8.3.1",
39
+ "@mui/x-charts": "8.3.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.9.0",
@@ -1,7 +1,7 @@
1
1
  import { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
2
2
  import { AxisId, ZoomOptions } from '@mui/x-charts/internals';
3
- import { HeatmapItemIdentifier, HeatmapSeriesType, DefaultizedHeatmapSeriesType, HeatmapValueType } from "../models/seriesType/heatmap.js";
4
3
  import { DefaultizedFunnelSeriesType, FunnelItemIdentifier, FunnelSeriesType, FunnelValueType } from "../FunnelChart/funnel.types.js";
4
+ import { HeatmapItemIdentifier, HeatmapSeriesType, DefaultizedHeatmapSeriesType, HeatmapValueType } from "../models/seriesType/heatmap.js";
5
5
  declare module '@mui/x-charts/internals' {
6
6
  interface ChartsSeriesConfig {
7
7
  heatmap: {
@@ -1,25 +0,0 @@
1
- import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
- /**
3
- * This is a custom "step" curve generator for the funnel chart.
4
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
5
- *
6
- * It takes into account the gap between the points and draws a smooth curve between them.
7
- *
8
- * It is based on the d3-shape step curve generator.
9
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
10
- */
11
- export declare class FunnelStep implements CurveGenerator {
12
- private context;
13
- private line;
14
- private x;
15
- private y;
16
- private currentPoint;
17
- private isHorizontal;
18
- private gap;
19
- constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
20
- areaStart(): void;
21
- areaEnd(): void;
22
- lineStart(): void;
23
- lineEnd(): void;
24
- point(x: number, y: number): void;
25
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FunnelStep = void 0;
7
- /**
8
- * This is a custom "step" curve generator for the funnel chart.
9
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
10
- *
11
- * It takes into account the gap between the points and draws a smooth curve between them.
12
- *
13
- * It is based on the d3-shape step curve generator.
14
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
15
- */
16
- class FunnelStep {
17
- constructor(context, isHorizontal, gap = 0) {
18
- this.context = void 0;
19
- this.line = NaN;
20
- this.x = NaN;
21
- this.y = NaN;
22
- this.currentPoint = 0;
23
- this.isHorizontal = false;
24
- this.gap = 0;
25
- this.context = context;
26
- this.isHorizontal = isHorizontal;
27
- this.gap = gap / 2;
28
- }
29
- areaStart() {
30
- this.line = 0;
31
- }
32
- areaEnd() {
33
- this.line = NaN;
34
- }
35
- lineStart() {
36
- this.x = NaN;
37
- this.y = NaN;
38
- this.currentPoint = 0;
39
- }
40
- lineEnd() {
41
- if (this.currentPoint === 2) {
42
- this.context.lineTo(this.x, this.y);
43
- }
44
- if (this.line || this.line !== 0 && this.currentPoint === 1) {
45
- this.context.closePath();
46
- }
47
- if (this.line >= 0) {
48
- this.line = 1 - this.line;
49
- }
50
- }
51
- point(x, y) {
52
- x = +x;
53
- y = +y;
54
-
55
- // 0 is the top-left corner.
56
- if (this.isHorizontal) {
57
- if (this.currentPoint === 0) {
58
- this.context.moveTo(x + this.gap, y);
59
- } else if (this.currentPoint === 1 || this.currentPoint === 2) {
60
- this.context.lineTo(x - this.gap, this.y);
61
- this.context.lineTo(x - this.gap, y);
62
- } else {
63
- this.context.lineTo(this.x - this.gap, y);
64
- this.context.lineTo(x + this.gap, y);
65
- }
66
- this.currentPoint += 1;
67
- this.x = x;
68
- this.y = y;
69
- return;
70
- }
71
-
72
- // 0 is the top-right corner.
73
- if (this.currentPoint === 0) {
74
- this.context.moveTo(x, y + this.gap);
75
- } else if (this.currentPoint === 3) {
76
- this.context.lineTo(x, this.y - this.gap);
77
- this.context.lineTo(x, y + this.gap);
78
- } else {
79
- this.context.lineTo(this.x, y - this.gap);
80
- this.context.lineTo(x, y - this.gap);
81
- }
82
- this.currentPoint += 1;
83
- this.x = x;
84
- this.y = y;
85
- }
86
- }
87
- exports.FunnelStep = FunnelStep;
@@ -1,25 +0,0 @@
1
- import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
- /**
3
- * This is a custom "step" curve generator for the funnel chart.
4
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
5
- *
6
- * It takes into account the gap between the points and draws a smooth curve between them.
7
- *
8
- * It is based on the d3-shape step curve generator.
9
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
10
- */
11
- export declare class FunnelStep implements CurveGenerator {
12
- private context;
13
- private line;
14
- private x;
15
- private y;
16
- private currentPoint;
17
- private isHorizontal;
18
- private gap;
19
- constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
20
- areaStart(): void;
21
- areaEnd(): void;
22
- lineStart(): void;
23
- lineEnd(): void;
24
- point(x: number, y: number): void;
25
- }
@@ -1,80 +0,0 @@
1
- /**
2
- * This is a custom "step" curve generator for the funnel chart.
3
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
4
- *
5
- * It takes into account the gap between the points and draws a smooth curve between them.
6
- *
7
- * It is based on the d3-shape step curve generator.
8
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
9
- */
10
- export class FunnelStep {
11
- constructor(context, isHorizontal, gap = 0) {
12
- this.context = void 0;
13
- this.line = NaN;
14
- this.x = NaN;
15
- this.y = NaN;
16
- this.currentPoint = 0;
17
- this.isHorizontal = false;
18
- this.gap = 0;
19
- this.context = context;
20
- this.isHorizontal = isHorizontal;
21
- this.gap = gap / 2;
22
- }
23
- areaStart() {
24
- this.line = 0;
25
- }
26
- areaEnd() {
27
- this.line = NaN;
28
- }
29
- lineStart() {
30
- this.x = NaN;
31
- this.y = NaN;
32
- this.currentPoint = 0;
33
- }
34
- lineEnd() {
35
- if (this.currentPoint === 2) {
36
- this.context.lineTo(this.x, this.y);
37
- }
38
- if (this.line || this.line !== 0 && this.currentPoint === 1) {
39
- this.context.closePath();
40
- }
41
- if (this.line >= 0) {
42
- this.line = 1 - this.line;
43
- }
44
- }
45
- point(x, y) {
46
- x = +x;
47
- y = +y;
48
-
49
- // 0 is the top-left corner.
50
- if (this.isHorizontal) {
51
- if (this.currentPoint === 0) {
52
- this.context.moveTo(x + this.gap, y);
53
- } else if (this.currentPoint === 1 || this.currentPoint === 2) {
54
- this.context.lineTo(x - this.gap, this.y);
55
- this.context.lineTo(x - this.gap, y);
56
- } else {
57
- this.context.lineTo(this.x - this.gap, y);
58
- this.context.lineTo(x + this.gap, y);
59
- }
60
- this.currentPoint += 1;
61
- this.x = x;
62
- this.y = y;
63
- return;
64
- }
65
-
66
- // 0 is the top-right corner.
67
- if (this.currentPoint === 0) {
68
- this.context.moveTo(x, y + this.gap);
69
- } else if (this.currentPoint === 3) {
70
- this.context.lineTo(x, this.y - this.gap);
71
- this.context.lineTo(x, y + this.gap);
72
- } else {
73
- this.context.lineTo(this.x, y - this.gap);
74
- this.context.lineTo(x, y - this.gap);
75
- }
76
- this.currentPoint += 1;
77
- this.x = x;
78
- this.y = y;
79
- }
80
- }