Skip to content

Commit

Permalink
resolve circulair import (#10247)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeLenaleee committed Mar 18, 2022
1 parent acc7d9e commit e9ce6ce
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 29 deletions.
34 changes: 34 additions & 0 deletions src/plugins/plugin.filler/filler.helper.js
@@ -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;
}
30 changes: 2 additions & 28 deletions src/plugins/plugin.filler/filler.target.js
@@ -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';

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/plugin.filler/filler.target.stack.js
Expand Up @@ -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
Expand Down

0 comments on commit e9ce6ce

Please sign in to comment.