* Helper function to get the items that intersect the event position * @param {Chart} chart - the chart * @param {Point} position - the point to be nearest to, in relative coordinates * @param {string} axis - the axis mode. x|y|xy|r * @param {boolean} [useFinalPosition] - use the element's anima
(chart, position, axis, useFinalPosition, includeInvisible)
| 112 | * @return {InteractionItem[]} the nearest items |
| 113 | */ |
| 114 | function getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) { |
| 115 | const items = []; |
| 116 | |
| 117 | if (!includeInvisible && !chart.isPointInArea(position)) { |
| 118 | return items; |
| 119 | } |
| 120 | |
| 121 | const evaluationFunc = function(element, datasetIndex, index) { |
| 122 | if (!includeInvisible && !_isPointInArea(element, chart.chartArea, 0)) { |
| 123 | return; |
| 124 | } |
| 125 | if (element.inRange(position.x, position.y, useFinalPosition)) { |
| 126 | items.push({element, datasetIndex, index}); |
| 127 | } |
| 128 | }; |
| 129 | |
| 130 | evaluateInteractionItems(chart, axis, position, evaluationFunc, true); |
| 131 | return items; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Helper function to get the items nearest to the event position for a radial chart |
no test coverage detected