tweak cell selection

This commit is contained in:
samunohito 2024-02-07 08:39:12 +09:00
parent b0b474d2a3
commit 173b90e124

View file

@ -455,7 +455,28 @@ function onLeftMouseDown(ev: MouseEvent) {
}
case 'normal': {
if (availableCellAddress(cellAddress)) {
selectionCell(cellAddress);
if (ev.shiftKey && selectedCell.value && !equalCellAddress(cellAddress, selectedCell.value.address)) {
const selectedCellAddress = selectedCell.value.address;
const leftTop = {
col: Math.min(selectedCellAddress.col, cellAddress.col),
row: Math.min(selectedCellAddress.row, cellAddress.row),
};
const rightBottom = {
col: Math.max(selectedCellAddress.col, cellAddress.col),
row: Math.max(selectedCellAddress.row, cellAddress.row),
};
unSelectionRangeAll();
expandCellRange(leftTop, rightBottom);
cells.value[selectedCellAddress.row].cells[selectedCellAddress.col].selected = true;
} else {
selectionCell(cellAddress);
}
previousCellAddress.value = cellAddress;
registerMouseUp();
registerMouseMove();