Skip to content

Commit

Permalink
feat: add padding to fontSize measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 committed Sep 6, 2021
1 parent 5f3cb36 commit 9017878
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion integration/tests/heatmap_stories.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Heatmap stories', () => {
);
});
it('should maximize the label fontSize', async () => {
await page.setViewport({ width: 360, height: 600 });
await page.setViewport({ width: 420, height: 600 });
await common.expectChartAtUrlToMatchScreenshot('http://localhost:9001/?path=/story/heatmap-alpha--categorical');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ export function shapeViewModel(
config.cell.label,
config.cell.label.minFontSize,
config.cell.label.maxFontSize,
cellWidthInner,
cellHeightInner,
// adding 4px padding per side to avoid that text touches the edges
cellWidthInner - 8,
cellHeightInner - 8,
);

acc[cellKey] = {
Expand Down
3 changes: 3 additions & 0 deletions storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ module.exports = {
reactOptions: {
fastRefresh: true,
},
typescript: {
reactDocgen: false,
},
};

0 comments on commit 9017878

Please sign in to comment.