* Helper function to get the items nearest to the event position for a radial chart * @param {Chart} chart - the chart to look at elements from * @param {Point} position - the point to be nearest to, in relative coordinates * @param {string} axis - the axes along which to measure distance * @par
(chart, position, axis, useFinalPosition)
| 140 | * @return {InteractionItem[]} the nearest items |
| 141 | */ |
| 142 | function getNearestRadialItems(chart, position, axis, useFinalPosition) { |
| 143 | let items = []; |
| 144 | |
| 145 | function evaluationFunc(element, datasetIndex, index) { |
| 146 | const {startAngle, endAngle} = element.getProps(['startAngle', 'endAngle'], useFinalPosition); |
| 147 | const {angle} = getAngleFromPoint(element, {x: position.x, y: position.y}); |
| 148 | |
| 149 | if (_angleBetween(angle, startAngle, endAngle)) { |
| 150 | items.push({element, datasetIndex, index}); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | evaluateInteractionItems(chart, axis, position, evaluationFunc); |
| 155 | return items; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Helper function to get the items nearest to the event position for a cartesian chart |
no test coverage detected