fix: prevent last gallery row from overflowing container
All checks were successful
Docker / build (release) Successful in 1m15s
All checks were successful
Docker / build (release) Successful in 1m15s
This commit is contained in:
parent
b57f9092aa
commit
eeb2e1566f
1 changed files with 4 additions and 4 deletions
|
|
@ -43,10 +43,10 @@
|
|||
const sumRatios = ratios.slice(start, end).reduce((a, b) => a + b, 0);
|
||||
const totalSpacing = SPACING * (count - 1);
|
||||
|
||||
// Don't stretch the last row if it's not full
|
||||
const rowHeight = isLastRow && count < 3
|
||||
? TARGET_HEIGHT
|
||||
: (containerWidth - totalSpacing) / sumRatios;
|
||||
// Fill the container width, except for a last row that isn't full:
|
||||
// it keeps the target height, but never wider than the container.
|
||||
const fitHeight = (containerWidth - totalSpacing) / sumRatios;
|
||||
const rowHeight = isLastRow ? Math.min(TARGET_HEIGHT, fitHeight) : fitHeight;
|
||||
|
||||
let left = PADDING;
|
||||
for (let i = start; i < end; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue