mirror of
https://github.com/samsonjs/immich.git
synced 2026-04-27 15:07:45 +00:00
fix(web): timeline multi select group state (#26180)
This commit is contained in:
parent
2d6580acd8
commit
34eb2e1410
1 changed files with 32 additions and 36 deletions
|
|
@ -443,54 +443,50 @@
|
||||||
assetInteraction.clearAssetSelectionCandidates();
|
assetInteraction.clearAssetSelectionCandidates();
|
||||||
|
|
||||||
if (assetInteraction.assetSelectionStart && rangeSelection) {
|
if (assetInteraction.assetSelectionStart && rangeSelection) {
|
||||||
let startBucket = timelineManager.getMonthGroupByAssetId(assetInteraction.assetSelectionStart.id);
|
const startBucket = timelineManager.getMonthGroupByAssetId(assetInteraction.assetSelectionStart.id);
|
||||||
let endBucket = timelineManager.getMonthGroupByAssetId(asset.id);
|
const endBucket = timelineManager.getMonthGroupByAssetId(asset.id);
|
||||||
|
|
||||||
if (startBucket === null || endBucket === null) {
|
if (!startBucket || !endBucket) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const monthGroups = timelineManager.months;
|
||||||
|
const startBucketIndex = monthGroups.indexOf(startBucket);
|
||||||
|
const endBucketIndex = monthGroups.indexOf(endBucket);
|
||||||
|
|
||||||
|
if (startBucketIndex === -1 || endBucketIndex === -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rangeStartIndex = Math.min(startBucketIndex, endBucketIndex);
|
||||||
|
const rangeEndIndex = Math.max(startBucketIndex, endBucketIndex);
|
||||||
|
|
||||||
// Select/deselect assets in range (start,end)
|
// Select/deselect assets in range (start,end)
|
||||||
let started = false;
|
for (let index = rangeStartIndex + 1; index < rangeEndIndex; index++) {
|
||||||
for (const monthGroup of timelineManager.months) {
|
const monthGroup = monthGroups[index];
|
||||||
if (monthGroup === endBucket) {
|
await timelineManager.loadMonthGroup(monthGroup.yearMonth);
|
||||||
break;
|
for (const monthAsset of monthGroup.assetsIterator()) {
|
||||||
}
|
if (deselect) {
|
||||||
if (started) {
|
assetInteraction.removeAssetFromMultiselectGroup(monthAsset.id);
|
||||||
await timelineManager.loadMonthGroup(monthGroup.yearMonth);
|
} else {
|
||||||
for (const asset of monthGroup.assetsIterator()) {
|
handleSelectAsset(monthAsset);
|
||||||
if (deselect) {
|
|
||||||
assetInteraction.removeAssetFromMultiselectGroup(asset.id);
|
|
||||||
} else {
|
|
||||||
handleSelectAsset(asset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (monthGroup === startBucket) {
|
|
||||||
started = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update date group selection in range [start,end]
|
// Update date group selection in range [start,end]
|
||||||
started = false;
|
for (let index = rangeStartIndex; index <= rangeEndIndex; index++) {
|
||||||
for (const monthGroup of timelineManager.months) {
|
const monthGroup = monthGroups[index];
|
||||||
if (monthGroup === startBucket) {
|
|
||||||
started = true;
|
// Split month group into day groups and check each group
|
||||||
}
|
for (const dayGroup of monthGroup.dayGroups) {
|
||||||
if (started) {
|
const dayGroupTitle = dayGroup.groupTitle;
|
||||||
// Split month group into day groups and check each group
|
if (dayGroup.getAssets().every((a) => assetInteraction.hasSelectedAsset(a.id))) {
|
||||||
for (const dayGroup of monthGroup.dayGroups) {
|
assetInteraction.addGroupToMultiselectGroup(dayGroupTitle);
|
||||||
const dayGroupTitle = dayGroup.groupTitle;
|
} else {
|
||||||
if (dayGroup.getAssets().every((a) => assetInteraction.hasSelectedAsset(a.id))) {
|
assetInteraction.removeGroupFromMultiselectGroup(dayGroupTitle);
|
||||||
assetInteraction.addGroupToMultiselectGroup(dayGroupTitle);
|
|
||||||
} else {
|
|
||||||
assetInteraction.removeGroupFromMultiselectGroup(dayGroupTitle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (monthGroup === endBucket) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue