FIX: Download all selected area

We were previously downloading only the bounds of the visible cells,
without taking into account the frozen rows/colums.

Fixes #343
This commit is contained in:
Nicolás Hatcher
2025-05-17 11:38:05 +02:00
committed by Nicolás Hatcher Andrés
parent c554d929f4
commit a5d8ee9ef0

View File

@@ -567,19 +567,15 @@ const Workbook = (props: { model: Model; workbookState: WorkbookState }) => {
const {
range: [rowStart, columnStart, rowEnd, columnEnd],
} = model.getSelectedView();
const { topLeftCell, bottomRightCell } =
worksheetCanvas.getVisibleCells();
const firstRow = Math.max(rowStart, topLeftCell.row);
const firstColumn = Math.max(columnStart, topLeftCell.column);
const lastRow = Math.min(rowEnd, bottomRightCell.row);
const lastColumn = Math.min(columnEnd, bottomRightCell.column);
// NB: cells outside of the displayed area are not rendered
// I think the only reasonable way to do this would be server side.
let [x, y] = worksheetCanvas.getCoordinatesByCell(
firstRow,
firstColumn,
rowStart,
columnStart,
);
const [x1, y1] = worksheetCanvas.getCoordinatesByCell(
lastRow + 1,
lastColumn + 1,
rowEnd,
columnEnd,
);
const width = (x1 - x) * devicePixelRatio;
const height = (y1 - y) * devicePixelRatio;