From b037d602b2a60b83c8b7bbe4fe930560b0816e0d Mon Sep 17 00:00:00 2001 From: susiekims Date: Thu, 5 Dec 2024 09:18:50 -0500 Subject: [PATCH] wip: test long press --- .../TooltipWrapper/TooltipWrapper.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/polaris-viz/src/components/TooltipWrapper/TooltipWrapper.tsx b/packages/polaris-viz/src/components/TooltipWrapper/TooltipWrapper.tsx index 4b90c76d7..c8e8a61f6 100644 --- a/packages/polaris-viz/src/components/TooltipWrapper/TooltipWrapper.tsx +++ b/packages/polaris-viz/src/components/TooltipWrapper/TooltipWrapper.tsx @@ -57,7 +57,7 @@ function TooltipWrapperRaw(props: BaseProps) { xScale, yScale, } = props; - const {scrollContainer, isTouchDevice} = useChartContext(); + const {scrollContainer, isTouchDevice, containerBounds} = useChartContext(); const [position, setPosition] = useState({ x: 0, y: 0, @@ -92,13 +92,14 @@ function TooltipWrapperRaw(props: BaseProps) { event?: MouseEvent | TouchEvent; index?: number; }) => { - const containerBounds = { - x: parentElement?.getBoundingClientRect().x ?? 0, - y: Number(parentElement?.getBoundingClientRect().y ?? 0), - // + Number(scrollContainer?.scrollTop ?? 0), - width: parentElement?.getBoundingClientRect().width ?? 0, - height: parentElement?.getBoundingClientRect().height ?? 0, - }; + // const containerBounds = { + // x: parentElement?.getBoundingClientRect().x ?? 0, + // y: Number(parentElement?.getBoundingClientRect().y ?? 0), + // // + Number(scrollContainer?.scrollTop ?? 0), + // width: parentElement?.getBoundingClientRect().width ?? 0, + // height: parentElement?.getBoundingClientRect().height ?? 0, + // }; + switch (chartType) { case InternalChartType.Line: return getLineChartTooltipPosition({