Skip to content

Commit c7dc311

Browse files
fix(web): multi-select (#18485)
1 parent 065f7c7 commit c7dc311

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

web/src/lib/components/photos-page/asset-grid.svelte

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,9 @@
564564
return;
565565
}
566566
567-
// Select/deselect assets in range (start,end]
567+
// Select/deselect assets in range (start,end)
568568
let started = false;
569569
for (const bucket of assetStore.buckets) {
570-
if (bucket === startBucket) {
571-
started = true;
572-
}
573570
if (bucket === endBucket) {
574571
break;
575572
}
@@ -583,27 +580,31 @@
583580
}
584581
}
585582
}
583+
if (bucket === startBucket) {
584+
started = true;
585+
}
586586
}
587587
588-
// Update date group selection
588+
// Update date group selection in range [start,end]
589589
started = false;
590590
for (const bucket of assetStore.buckets) {
591591
if (bucket === startBucket) {
592592
started = true;
593593
}
594+
if (started) {
595+
// Split bucket into date groups and check each group
596+
for (const dateGroup of bucket.dateGroups) {
597+
const dateGroupTitle = dateGroup.groupTitle;
598+
if (dateGroup.getAssets().every((a) => assetInteraction.hasSelectedAsset(a.id))) {
599+
assetInteraction.addGroupToMultiselectGroup(dateGroupTitle);
600+
} else {
601+
assetInteraction.removeGroupFromMultiselectGroup(dateGroupTitle);
602+
}
603+
}
604+
}
594605
if (bucket === endBucket) {
595606
break;
596607
}
597-
598-
// Split bucket into date groups and check each group
599-
for (const dateGroup of bucket.dateGroups) {
600-
const dateGroupTitle = dateGroup.groupTitle;
601-
if (dateGroup.getAssets().every((a) => assetInteraction.hasSelectedAsset(a.id))) {
602-
assetInteraction.addGroupToMultiselectGroup(dateGroupTitle);
603-
} else {
604-
assetInteraction.removeGroupFromMultiselectGroup(dateGroupTitle);
605-
}
606-
}
607608
}
608609
}
609610

0 commit comments

Comments
 (0)