Skip to content

Commit

Permalink
🐛 (static-chart) use correct details font-size for charts with ideal …
Browse files Browse the repository at this point in the history
…bounds
  • Loading branch information
sophiamersmann committed Dec 19, 2023
1 parent 2441c9a commit 02c6628
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 02c6628

Please sign in to comment.