fix shift selection bugs

This commit is contained in:
Samuel Lorch 2023-03-13 21:31:16 +01:00
parent d97f7a4e93
commit 262ecc81d4

View file

@ -49,16 +49,20 @@ function toggleSorting(columnName: string) {
function rowSelection(index: number) { function rowSelection(index: number) {
if (shiftState) { if (shiftState) {
let last = selection[selection.length-1]; if (selection.length === 0) {
let start = index; selection = [index];
let end = last; } else {
if (last < start) { let last = selection[selection.length-1];
start = last; let start = index;
end = index; let end = last;
} if (last < start) {
for (let i = start; i < end; i++ ) { start = last;
if (!selection.includes(i)) { end = index;
selection = [...selection, i]; }
for (let i = start; i <= end; i++ ) {
if (!selection.includes(i)) {
selection = [...selection, i];
}
} }
} }
} else if (ctrlState) { } else if (ctrlState) {