From 3390c34d0a57ef9db2864bd59610c1c20357a6b9 Mon Sep 17 00:00:00 2001 From: Pico2x Date: Wed, 5 Oct 2022 14:19:26 +0100 Subject: [PATCH] Mobile tooltip isn't occluded by finger anymore --- web/components/charts/helpers.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/web/components/charts/helpers.tsx b/web/components/charts/helpers.tsx index edeccebb..684f6d76 100644 --- a/web/components/charts/helpers.tsx +++ b/web/components/charts/helpers.tsx @@ -233,8 +233,9 @@ export const SVGChart = (props: { ttParams.y, innerW, innerH, - tooltipMeasure.width, - tooltipMeasure.height + tooltipMeasure.width ?? 140, + tooltipMeasure.height ?? 35, + isMobile ?? false )} > { let left = mouseX + 12 - let bottom = containerHeight - mouseY + 12 + let bottom = !isMobile + ? containerHeight - mouseY + 12 + : containerHeight - tooltipHeight + 12 if (tooltipWidth != null) { const overflow = left + tooltipWidth - containerWidth if (overflow > 0) { left -= overflow } } + if (tooltipHeight != null) { const overflow = tooltipHeight - mouseY if (overflow > 0) { bottom -= overflow } } + return { left, bottom } }