From f2038bd0d89c8e4b3eb93748fad1d470e3a79649 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Tue, 17 Aug 2021 17:32:05 -0700 Subject: [PATCH] Give warning when over 12 tiles --- src/VideoGrid.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/VideoGrid.jsx b/src/VideoGrid.jsx index 1a665b0..de3ce47 100644 --- a/src/VideoGrid.jsx +++ b/src/VideoGrid.jsx @@ -37,6 +37,10 @@ function getTilePositions(tileCount, gridBounds) { const { width: gridWidth, height: gridHeight } = gridBounds; const gap = 8; + if (tileCount > 12) { + console.warn("Over 12 tiles is not currently supported"); + } + if (tileCount > 0) { const aspectRatio = gridWidth / gridHeight; @@ -49,6 +53,10 @@ function getTilePositions(tileCount, gridBounds) { } else if (tileCount <= 12) { columnCount = 2; rowCount = Math.ceil(tileCount / 2); + } else { + // Unsupported + columnCount = 3; + rowCount = Math.ceil(tileCount / 2); } } else { if (tileCount === 1) { @@ -72,6 +80,10 @@ function getTilePositions(tileCount, gridBounds) { } else if (tileCount <= 12) { columnCount = 4; rowCount = 3; + } else { + // Unsupported + columnCount = 4; + rowCount = 4; } }