From 02c6628810e4eaea03a154a38470a026b39b5c65 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Mon, 18 Dec 2023 10:19:42 +0000 Subject: [PATCH] :bug: (static-chart) use correct details font-size for charts with ideal bounds --- packages/@ourworldindata/grapher/src/core/Grapher.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/@ourworldindata/grapher/src/core/Grapher.tsx b/packages/@ourworldindata/grapher/src/core/Grapher.tsx index 213e628c7ae..6f261d7cfdf 100644 --- a/packages/@ourworldindata/grapher/src/core/Grapher.tsx +++ b/packages/@ourworldindata/grapher/src/core/Grapher.tsx @@ -1268,9 +1268,9 @@ export class Grapher } // can't use the computed property here because Grapher might not currently be in static mode - const baseFontSize = this.computeBaseFontSizeFromHeight( - this.staticBounds - ) + const baseFontSize = this.areStaticBoundsSmall + ? this.computeBaseFontSizeFromHeight(this.staticBounds) + : 18 return new MarkdownTextWrap({ text, @@ -2668,6 +2668,10 @@ export class Grapher @computed get isStaticAndSmall(): boolean { if (!this.isStatic) return false + return this.areStaticBoundsSmall + } + + @computed get areStaticBoundsSmall(): boolean { const { idealBounds, staticBounds } = this const idealPixelCount = idealBounds.width * idealBounds.height const staticPixelCount = staticBounds.width * staticBounds.height