(payload: ChartGPUEventPayload)
| 2472 | }; |
| 2473 | |
| 2474 | const onMouseMove = (payload: ChartGPUEventPayload): void => { |
| 2475 | pointerState = { |
| 2476 | source: 'mouse', |
| 2477 | x: payload.x, |
| 2478 | y: payload.y, |
| 2479 | gridX: payload.gridX, |
| 2480 | gridY: payload.gridY, |
| 2481 | isInGrid: payload.isInGrid, |
| 2482 | hasPointer: true, |
| 2483 | }; |
| 2484 | |
| 2485 | // If we're over the plot and we have recent interaction scales, update interaction-x in domain units. |
| 2486 | // (Best-effort; render() refreshes scales and overlays.) |
| 2487 | if (payload.isInGrid && lastInteractionScales) { |
| 2488 | const xDomain = lastInteractionScales.xScale.invert(payload.gridX); |
| 2489 | setInteractionXInternal(Number.isFinite(xDomain) ? xDomain : null, 'mouse'); |
| 2490 | } else if (!payload.isInGrid) { |
| 2491 | // Clear interaction-x when leaving the plot area (keeps synced charts from “sticking”). |
| 2492 | setInteractionXInternal(null, 'mouse'); |
| 2493 | } |
| 2494 | |
| 2495 | crosshairRenderer.setVisible(payload.isInGrid); |
| 2496 | emitCrosshairCallback(payload.isInGrid ? payload.x : null); |
| 2497 | emitHoverCallback(payload.isInGrid ? payload : null); |
| 2498 | requestRender(); |
| 2499 | }; |
| 2500 | |
| 2501 | const onMouseLeave = (_payload: ChartGPUEventPayload): void => { |
| 2502 | // Only clear interaction overlays for real pointer interaction. |
nothing calls this directly
no test coverage detected