From 743ea56a6926b15c98be882fcfd405f095f6507a Mon Sep 17 00:00:00 2001 From: Amy Date: Thu, 26 Aug 2021 16:05:20 -0400 Subject: [PATCH] Improve shape generation on small desktop screens --- components/ShapesBackground.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/ShapesBackground.tsx b/components/ShapesBackground.tsx index c260aecf..fd7db98c 100644 --- a/components/ShapesBackground.tsx +++ b/components/ShapesBackground.tsx @@ -187,7 +187,7 @@ export const defaultGetShapesConfig = ((pageWidth, pageHeight) => { const defaultConfig: ShapesConfig = {}; const gap = 20; - const boxWidth = Math.max(300, (pageWidth - 800 - 2 * gap) / 2); + const boxWidth = Math.max(150, (pageWidth - 800 - 2 * gap) / 2); const boxHeight = 400; for (let y = 0; y + boxHeight <= pageHeight; y += gap + boxHeight) { @@ -196,7 +196,10 @@ export const defaultGetShapesConfig = ((pageWidth, pageHeight) => { continue; } - const size = y == 0 || y + 2 * boxHeight > pageHeight ? "big" : "small"; + const size = + boxWidth > 150 && (y == 0 || y + 2 * boxHeight > pageHeight) + ? "big" + : "small"; const shape: ShapeType = getRandomShape(size); const verticalOffset = getVerticalOffset(boxHeight, shape); const horizontalOffset = getHorizontalOffset(boxWidth - 2 * gap, shape);