MCPcopy
hub / github.com/chartjs/Chart.js / inRange

Method inRange

src/elements/element.arc.ts:353–370  ·  view source on GitHub ↗
(chartX: number, chartY: number, useFinalPosition: boolean)

Source from the content-addressed store, hash-verified

351 }
352
353 inRange(chartX: number, chartY: number, useFinalPosition: boolean) {
354 const point = this.getProps(['x', 'y'], useFinalPosition);
355 const {angle, distance} = getAngleFromPoint(point, {x: chartX, y: chartY});
356 const {startAngle, endAngle, innerRadius, outerRadius, circumference} = this.getProps([
357 'startAngle',
358 'endAngle',
359 'innerRadius',
360 'outerRadius',
361 'circumference'
362 ], useFinalPosition);
363 const rAdjust = (this.options.spacing + this.options.borderWidth) / 2;
364 const _circumference = valueOrDefault(circumference, endAngle - startAngle);
365 const nonZeroBetween = _angleBetween(angle, startAngle, endAngle) && startAngle !== endAngle;
366 const betweenAngles = _circumference >= TAU || nonZeroBetween;
367 const withinRadius = _isBetween(distance, innerRadius + rAdjust, outerRadius + rAdjust);
368
369 return (betweenAngles && withinRadius);
370 }
371
372 getCenterPoint(useFinalPosition: boolean) {
373 const {x, y, startAngle, endAngle, innerRadius, outerRadius} = this.getProps([

Callers

nothing calls this directly

Calls 5

getAngleFromPointFunction · 0.85
valueOrDefaultFunction · 0.85
_angleBetweenFunction · 0.85
_isBetweenFunction · 0.85
getPropsMethod · 0.80

Tested by

no test coverage detected