1
+ /* eslint-disable @typescript-eslint/no-use-before-define */
1
2
import { _angleBetween , _angleDiff , _isBetween , _normalizeAngle } from './helpers.math.js' ;
2
3
import { createContext } from './helpers.options.js' ;
3
4
import type { LineElement , LineOptions , PointElement , Segment , SegmentStyle , SegmentBounds } from '../types/index.js' ;
@@ -58,17 +59,6 @@ function getSegment(segment: Segment, points: Point[], bounds: SegmentBounds) {
58
59
59
60
/**
60
61
* Returns the sub-segment(s) of a line segment that fall in the given bounds
61
- * @param {object } segment
62
- * @param {number } segment.start - start index of the segment, referring the points array
63
- * @param {number } segment.end - end index of the segment, referring the points array
64
- * @param {boolean } segment.loop - indicates that the segment is a loop
65
- * @param {object } [segment.style] - segment style
66
- * @param {PointElement[] } points - the points that this segment refers to
67
- * @param {object } [bounds]
68
- * @param {string } bounds.property - the property of a `PointElement` we are bounding. `x`, `y` or `angle`.
69
- * @param {number } bounds.start - start value of the property
70
- * @param {number } bounds.end - end value of the property
71
- * @private
72
62
**/
73
63
// eslint-disable-next-line max-statements, complexity
74
64
export function _boundSegment ( segment : Segment , points : PointElement [ ] , bounds : SegmentBounds ) {
@@ -128,12 +118,6 @@ export function _boundSegment(segment: Segment, points: PointElement[], bounds:
128
118
129
119
/**
130
120
* Returns the segments of the line that are inside given bounds
131
- * @param {LineElement } line
132
- * @param {object } [bounds]
133
- * @param {string } bounds.property - the property we are bounding with. `x`, `y` or `angle`.
134
- * @param {number } bounds.start - start value of the `property`
135
- * @param {number } bounds.end - end value of the `property`
136
- * @private
137
121
*/
138
122
export function _boundSegments ( line : LineElement , bounds : SegmentBounds ) {
139
123
const result = [ ] ;
@@ -187,10 +171,6 @@ function findStartAndEnd(points: PointElement[], count: number, loop: boolean, s
187
171
188
172
/**
189
173
* Compute solid segments from Points, when spanGaps === false
190
- * @param {PointElement[] } points - the points
191
- * @param {number } start - start index
192
- * @param {number } max - max index (can go past count on a loop)
193
- * @param {boolean } loop - boolean indicating that this would be a loop if no gaps are found
194
174
*/
195
175
function solidSegments ( points : PointElement [ ] , start : number , max : number , loop : boolean ) {
196
176
const count = points . length ;
@@ -227,10 +207,6 @@ function solidSegments(points: PointElement[], start: number, max: number, loop:
227
207
/**
228
208
* Compute the continuous segments that define the whole line
229
209
* There can be skipped points within a segment, if spanGaps is true.
230
- * @param {LineElement } line
231
- * @param {object } [segmentOptions]
232
- * @return {Segment[] }
233
- * @private
234
210
*/
235
211
export function _computeSegments ( line : LineElement , segmentOptions : AnyObject ) {
236
212
const points = line . points ;
@@ -253,26 +229,13 @@ export function _computeSegments(line: LineElement, segmentOptions: AnyObject) {
253
229
return splitByStyles ( line , solidSegments ( points , start , max , completeLoop ) , points , segmentOptions ) ;
254
230
}
255
231
256
- /**
257
- * @param {Segment[] } segments
258
- * @param {PointElement[] } points
259
- * @param {object } [segmentOptions]
260
- * @return {Segment[] }
261
- */
262
232
function splitByStyles ( line : LineElement , segments : Segment [ ] , points : PointElement [ ] , segmentOptions : AnyObject ) {
263
233
if ( ! segmentOptions || ! segmentOptions . setContext || ! points ) {
264
234
return segments ;
265
235
}
266
236
return doSplitByStyles ( line , segments , points , segmentOptions ) ;
267
237
}
268
238
269
- /**
270
- * @param {LineElement } line
271
- * @param {Segment[] } segments
272
- * @param {PointElement[] } points
273
- * @param {object } [segmentOptions]
274
- * @return {Segment[] }
275
- */
276
239
function doSplitByStyles ( line : LineElement , segments : Segment [ ] , points : PointElement [ ] , segmentOptions : AnyObject ) {
277
240
const chartContext = line . _chart . getContext ( ) ;
278
241
const baseStyle = readStyle ( line . options ) ;
0 commit comments