]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
resolve circulair import (#10247)
authorJacco van den Berg <39033624+LeeLenaleee@users.noreply.github.com>
Fri, 18 Mar 2022 21:39:55 +0000 (22:39 +0100)
committerGitHub <noreply@github.com>
Fri, 18 Mar 2022 21:39:55 +0000 (17:39 -0400)
src/plugins/plugin.filler/filler.helper.js [new file with mode: 0644]
src/plugins/plugin.filler/filler.target.js
src/plugins/plugin.filler/filler.target.stack.js

diff --git a/src/plugins/plugin.filler/filler.helper.js b/src/plugins/plugin.filler/filler.helper.js
new file mode 100644 (file)
index 0000000..ec9fcdb
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * @typedef { import('../../core/core.controller').default } Chart
+ * @typedef { import('../../core/core.scale').default } Scale
+ * @typedef { import('../../elements/element.point').default } PointElement
+ */
+
+import {LineElement} from '../../elements';
+import {isArray} from '../../helpers';
+import {_pointsFromSegments} from './filler.segment';
+
+/**
+ * @param {PointElement[] | { x: number; y: number; }} boundary
+ * @param {LineElement} line
+ * @return {LineElement?}
+ */
+export function _createBoundaryLine(boundary, line) {
+  let points = [];
+  let _loop = false;
+
+  if (isArray(boundary)) {
+    _loop = true;
+    // @ts-ignore
+    points = boundary;
+  } else {
+    points = _pointsFromSegments(boundary, line);
+  }
+
+  return points.length ? new LineElement({
+    points,
+    options: {tension: 0},
+    _loop,
+    _fullLoop: _loop
+  }) : null;
+}
index e7dbf3dfb14ad1a0752a8d2248d8fea0b4fd07ac..2547636c274074042e61928a164d4ae340b2278a 100644 (file)
@@ -1,7 +1,6 @@
-import {LineElement} from '../../elements';
-import {isArray, isFinite} from '../../helpers';
+import {isFinite} from '../../helpers';
+import {_createBoundaryLine} from './filler.helper';
 import {_getTargetPixel, _getTargetValue} from './filler.options';
-import {_pointsFromSegments} from './filler.segment';
 import {_buildStackLine} from './filler.target.stack';
 import {simpleArc} from './simpleArc';
 
@@ -35,31 +34,6 @@ export function _getTarget(source) {
   return _createBoundaryLine(boundary, line);
 }
 
-/**
- * @param {PointElement[] | { x: number; y: number; }} boundary
- * @param {LineElement} line
- * @return {LineElement?}
- */
-export function _createBoundaryLine(boundary, line) {
-  let points = [];
-  let _loop = false;
-
-  if (isArray(boundary)) {
-    _loop = true;
-    // @ts-ignore
-    points = boundary;
-  } else {
-    points = _pointsFromSegments(boundary, line);
-  }
-
-  return points.length ? new LineElement({
-    points,
-    options: {tension: 0},
-    _loop,
-    _fullLoop: _loop
-  }) : null;
-}
-
 /**
  * @param {Chart} chart
  * @param {number} index
index dcb974b84706b164b5aa5b4f0ab56dfe44a381b1..b32fa1fb54e01521760e52de9903903d53d9a91a 100644 (file)
@@ -6,7 +6,7 @@
 
 import {LineElement} from '../../elements';
 import {_isBetween} from '../../helpers';
-import {_createBoundaryLine} from './filler.target';
+import {_createBoundaryLine} from './filler.helper';
 
 /**
  * @param {{ chart: Chart; scale: Scale; index: number; line: LineElement; }} source