Improve shape generation on small desktop screens

This commit is contained in:
Amy 2021-08-26 16:05:20 -04:00
parent 711152c428
commit 743ea56a69
1 changed files with 5 additions and 2 deletions

View File

@ -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);