(next: HitTestMatch | null, event: PointerEvent)
| 1130 | }; |
| 1131 | |
| 1132 | const setHovered = (next: HitTestMatch | null, event: PointerEvent): void => { |
| 1133 | const prev = hovered; |
| 1134 | hovered = next; |
| 1135 | |
| 1136 | if (prev === null && next === null) return; |
| 1137 | |
| 1138 | if (prev === null && next !== null) { |
| 1139 | emit('mouseover', buildPayload(next, event)); |
| 1140 | return; |
| 1141 | } |
| 1142 | |
| 1143 | if (prev !== null && next === null) { |
| 1144 | emit('mouseout', buildPayload(prev, event)); |
| 1145 | return; |
| 1146 | } |
| 1147 | |
| 1148 | if (prev === null || next === null) return; |
| 1149 | |
| 1150 | const prevSeriesIndex = prev.kind === 'cartesian' ? prev.match.seriesIndex : prev.seriesIndex; |
| 1151 | const prevDataIndex = prev.kind === 'cartesian' ? prev.match.dataIndex : prev.dataIndex; |
| 1152 | const nextSeriesIndex = next.kind === 'cartesian' ? next.match.seriesIndex : next.seriesIndex; |
| 1153 | const nextDataIndex = next.kind === 'cartesian' ? next.match.dataIndex : next.dataIndex; |
| 1154 | |
| 1155 | const samePoint = prevSeriesIndex === nextSeriesIndex && prevDataIndex === nextDataIndex; |
| 1156 | if (samePoint) return; |
| 1157 | |
| 1158 | emit('mouseout', buildPayload(prev, event)); |
| 1159 | emit('mouseover', buildPayload(next, event)); |
| 1160 | }; |
| 1161 | |
| 1162 | const clearTapCandidateIfMatches = (e: PointerEvent): void => { |
| 1163 | if (!tapCandidate) return; |
no test coverage detected