diff --git a/web/utils/text-utils.js b/web/utils/text-utils.js --- a/web/utils/text-utils.js +++ b/web/utils/text-utils.js @@ -6,8 +6,12 @@ function calculateMaxTextWidth( texts: $ReadOnlyArray, - font: string, + fontSize: number, ): number { + const font = + `${fontSize}px "Inter", -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", ` + + '"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", ui-sans-serif'; + if (!canvas) { canvas = document.createElement('canvas'); } diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js --- a/web/utils/tooltip-utils.js +++ b/web/utils/tooltip-utils.js @@ -46,10 +46,6 @@ +actionButtonContent: React.Node, }; -const font = - '14px "Inter", -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", ' + - '"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", ui-sans-serif'; - type FindTooltipPositionArgs = { +sourcePositionInfo: PositionInfo, +tooltipSize: TooltipSize, @@ -335,7 +331,7 @@ +height: number, } { const textWidth = - calculateMaxTextWidth([...tooltipLabels, timestamp], font) + + calculateMaxTextWidth([...tooltipLabels, timestamp], 14) + 2 * tooltipLabelStyle.padding; const buttonsWidth = tooltipLabels.length *