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

Function handlePointerEvent

src/core/createRenderCoordinator.ts:4693–4885  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

4691 };
4692
4693 const handlePointerEvent: RenderCoordinator['handlePointerEvent'] = (event) => {
4694 assertNotDisposed();
4695 if (domOverlaysEnabled) {
4696 // When DOM overlays are enabled, ignore handlePointerEvent (use native DOM events instead)
4697 return;
4698 }
4699
4700 const canvas = gpuContext.canvas;
4701 if (!canvas) return;
4702
4703 // Validate event coordinates (guard against NaN/Infinity from worker thread serialization issues)
4704 if (
4705 !Number.isFinite(event.x) ||
4706 !Number.isFinite(event.y) ||
4707 !Number.isFinite(event.gridX) ||
4708 !Number.isFinite(event.gridY) ||
4709 !Number.isFinite(event.plotWidthCss) ||
4710 !Number.isFinite(event.plotHeightCss)
4711 ) {
4712 return;
4713 }
4714
4715 // Use pre-computed grid coordinates from event
4716 const { type, x, y, gridX, gridY, plotWidthCss, plotHeightCss, isInGrid } = event;
4717
4718 if (type === 'leave') {
4719 pointerState = { ...pointerState, isInGrid: false, hasPointer: false };
4720 crosshairRenderer.setVisible(false);
4721 lastTooltipContent = null;
4722 lastTooltipX = null;
4723 lastTooltipY = null;
4724
4725 hideTooltipInternal();
4726 emitCrosshairCallback(null);
4727 emitHoverCallback(null);
4728
4729 setInteractionXInternal(null, 'mouse');
4730 requestRender();
4731 return;
4732 }
4733
4734 if (type === 'move') {
4735 // Update pointer state for hover/crosshair
4736 pointerState = {
4737 source: 'mouse',
4738 x,
4739 y,
4740 gridX,
4741 gridY,
4742 isInGrid,
4743 hasPointer: true,
4744 };
4745
4746 requestRender();
4747 return;
4748 }
4749
4750 if (type === 'click') {

Callers

nothing calls this directly

Calls 15

findNearestPointFunction · 0.90
hideTooltipInternalFunction · 0.85
emitCrosshairCallbackFunction · 0.85
emitHoverCallbackFunction · 0.85
setInteractionXInternalFunction · 0.85
findPieSliceAtPointerFunction · 0.85
findCandlestickAtPointerFunction · 0.85
getRangeMethod · 0.80
panMethod · 0.80
zoomInMethod · 0.80
zoomOutMethod · 0.80
assertNotDisposedFunction · 0.70

Tested by

no test coverage detected