Skip to content

Commit

Permalink
refactor: remove jsdoc types
Browse files Browse the repository at this point in the history
  • Loading branch information
Arantiryo committed Feb 7, 2023
1 parent 71e1bc1 commit a6ea376
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions src/helpers/helpers.segment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import {_angleBetween, _angleDiff, _isBetween, _normalizeAngle} from './helpers.math.js';
import {createContext} from './helpers.options.js';
import type {LineElement, LineOptions, PointElement, Segment, SegmentStyle, SegmentBounds} from '../types/index.js';
Expand Down Expand Up @@ -58,17 +59,6 @@ function getSegment(segment: Segment, points: Point[], bounds: SegmentBounds) {

/**
* Returns the sub-segment(s) of a line segment that fall in the given bounds
* @param {object} segment
* @param {number} segment.start - start index of the segment, referring the points array
* @param {number} segment.end - end index of the segment, referring the points array
* @param {boolean} segment.loop - indicates that the segment is a loop
* @param {object} [segment.style] - segment style
* @param {PointElement[]} points - the points that this segment refers to
* @param {object} [bounds]
* @param {string} bounds.property - the property of a `PointElement` we are bounding. `x`, `y` or `angle`.
* @param {number} bounds.start - start value of the property
* @param {number} bounds.end - end value of the property
* @private
**/
// eslint-disable-next-line max-statements, complexity
export function _boundSegment(segment: Segment, points: PointElement[], bounds: SegmentBounds) {
Expand Down Expand Up @@ -128,12 +118,6 @@ export function _boundSegment(segment: Segment, points: PointElement[], bounds:

/**
* Returns the segments of the line that are inside given bounds
* @param {LineElement} line
* @param {object} [bounds]
* @param {string} bounds.property - the property we are bounding with. `x`, `y` or `angle`.
* @param {number} bounds.start - start value of the `property`
* @param {number} bounds.end - end value of the `property`
* @private
*/
export function _boundSegments(line: LineElement, bounds: SegmentBounds) {
const result = [];
Expand Down Expand Up @@ -187,10 +171,6 @@ function findStartAndEnd(points: PointElement[], count: number, loop: boolean, s

/**
* Compute solid segments from Points, when spanGaps === false
* @param {PointElement[]} points - the points
* @param {number} start - start index
* @param {number} max - max index (can go past count on a loop)
* @param {boolean} loop - boolean indicating that this would be a loop if no gaps are found
*/
function solidSegments(points: PointElement[], start: number, max: number, loop: boolean) {
const count = points.length;
Expand Down Expand Up @@ -227,10 +207,6 @@ function solidSegments(points: PointElement[], start: number, max: number, loop:
/**
* Compute the continuous segments that define the whole line
* There can be skipped points within a segment, if spanGaps is true.
* @param {LineElement} line
* @param {object} [segmentOptions]
* @return {Segment[]}
* @private
*/
export function _computeSegments(line: LineElement, segmentOptions: AnyObject) {
const points = line.points;
Expand All @@ -253,26 +229,13 @@ export function _computeSegments(line: LineElement, segmentOptions: AnyObject) {
return splitByStyles(line, solidSegments(points, start, max, completeLoop), points, segmentOptions);
}

/**
* @param {Segment[]} segments
* @param {PointElement[]} points
* @param {object} [segmentOptions]
* @return {Segment[]}
*/
function splitByStyles(line: LineElement, segments: Segment[], points: PointElement[], segmentOptions: AnyObject) {
if (!segmentOptions || !segmentOptions.setContext || !points) {
return segments;
}
return doSplitByStyles(line, segments, points, segmentOptions);
}

/**
* @param {LineElement} line
* @param {Segment[]} segments
* @param {PointElement[]} points
* @param {object} [segmentOptions]
* @return {Segment[]}
*/
function doSplitByStyles(line: LineElement, segments: Segment[], points: PointElement[], segmentOptions: AnyObject) {
const chartContext = line._chart.getContext();
const baseStyle = readStyle(line.options);
Expand Down

0 comments on commit a6ea376

Please sign in to comment.