Give warning when over 12 tiles
This commit is contained in:
@@ -37,6 +37,10 @@ function getTilePositions(tileCount, gridBounds) {
|
|||||||
const { width: gridWidth, height: gridHeight } = gridBounds;
|
const { width: gridWidth, height: gridHeight } = gridBounds;
|
||||||
const gap = 8;
|
const gap = 8;
|
||||||
|
|
||||||
|
if (tileCount > 12) {
|
||||||
|
console.warn("Over 12 tiles is not currently supported");
|
||||||
|
}
|
||||||
|
|
||||||
if (tileCount > 0) {
|
if (tileCount > 0) {
|
||||||
const aspectRatio = gridWidth / gridHeight;
|
const aspectRatio = gridWidth / gridHeight;
|
||||||
|
|
||||||
@@ -49,6 +53,10 @@ function getTilePositions(tileCount, gridBounds) {
|
|||||||
} else if (tileCount <= 12) {
|
} else if (tileCount <= 12) {
|
||||||
columnCount = 2;
|
columnCount = 2;
|
||||||
rowCount = Math.ceil(tileCount / 2);
|
rowCount = Math.ceil(tileCount / 2);
|
||||||
|
} else {
|
||||||
|
// Unsupported
|
||||||
|
columnCount = 3;
|
||||||
|
rowCount = Math.ceil(tileCount / 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (tileCount === 1) {
|
if (tileCount === 1) {
|
||||||
@@ -72,6 +80,10 @@ function getTilePositions(tileCount, gridBounds) {
|
|||||||
} else if (tileCount <= 12) {
|
} else if (tileCount <= 12) {
|
||||||
columnCount = 4;
|
columnCount = 4;
|
||||||
rowCount = 3;
|
rowCount = 3;
|
||||||
|
} else {
|
||||||
|
// Unsupported
|
||||||
|
columnCount = 4;
|
||||||
|
rowCount = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user