MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / setHovered

Function setHovered

src/ChartGPU.ts:1132–1160  ·  view source on GitHub ↗
(next: HitTestMatch | null, event: PointerEvent)

Source from the content-addressed store, hash-verified

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;

Callers 4

onPointerMoveFunction · 0.70
onPointerLeaveFunction · 0.70
onPointerCancelFunction · 0.70
onLostPointerCaptureFunction · 0.70

Calls 2

buildPayloadFunction · 0.85
emitFunction · 0.70

Tested by

no test coverage detected