Skip to content

Commit

Permalink
Fix resize bug dragging from 0 px width in RelalizationNumberDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenherje committed Nov 7, 2024
1 parent 928ba1c commit 4684aa0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ export const RealizationNumberDisplay: React.FC<RealizationNumberDisplayProps> =
const nonCompactWidthAndHeightPx = 12;

// Find the number of realizations that can fit in a row based on non-compact size, as factor of 5
const candidateNumberOfRealizationsPerRow = Math.floor(
divSize.width / (nonCompactWidthAndHeightPx + nonCompactGapPx)
const candidateNumberOfRealizationsPerRow = Math.max(
5,
Math.floor(divSize.width / (nonCompactWidthAndHeightPx + nonCompactGapPx))
);
const remainder = candidateNumberOfRealizationsPerRow % 5;
const newNumberOfRealizationsPerRow =
Expand Down

0 comments on commit 4684aa0

Please sign in to comment.