fix findFreeSpace for apps

This commit is contained in:
Ruben Fiszel
2023-10-21 10:49:10 +02:00
parent d89e3934fe
commit 00de758190
2 changed files with 2 additions and 3 deletions

View File

@@ -26,7 +26,6 @@ const gridHelp = {
findSpace(item, items, cols) {
let matrix = makeMatrixFromItems(items, getRowsCount(items, cols), cols)
let position = findFreeSpaceForItem(matrix, item[cols])
return position
}

View File

@@ -33,7 +33,7 @@ export function findFreeSpaceForItem<T>(matrix: FilledItem<T>[][], item: ItemLay
const cols = matrix[0].length
const w = Math.min(cols, item.w)
const h = item.h
let xNtime = cols - w
let xNtime = cols - w + 1
let getMatrixRows = matrix.length
const range = Array.from({ length: getMatrixRows }, (_, y) =>
@@ -57,7 +57,7 @@ export function findFreeSpaceForItem<T>(matrix: FilledItem<T>[][], item: ItemLay
return { x, y }
}
}
return {
y: getMatrixRows,
x: 0