handle case where range select with few selected and few unselected items
select all the items in the union of two ranges
This commit is contained in:
parent
6d76611079
commit
73882919d1
|
@ -315,9 +315,12 @@ const PhotoFrame = ({
|
|||
|
||||
const handleRangeSelect = (index: number) => () => {
|
||||
if (rangeStart !== index) {
|
||||
const checked = !!selected[filteredData[index].id];
|
||||
const direction =
|
||||
(index - rangeStart) / Math.abs(index - rangeStart);
|
||||
let checked = true;
|
||||
for (let i = rangeStart; i !== index; i += direction) {
|
||||
checked = checked && !!selected[filteredData[i].id];
|
||||
}
|
||||
for (let i = rangeStart; i !== index; i += direction) {
|
||||
handleSelect(filteredData[i].id)(!checked);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue