mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
fix(web): multi-select in ascending asset order
This commit is contained in:
parent
ecc58a8971
commit
367a810137
@ -1,4 +1,5 @@
|
|||||||
import { plainDateTimeCompare, type TimelinePlainYearMonth } from '$lib/utils/timeline-util';
|
import { plainDateTimeCompare, type TimelinePlainYearMonth } from '$lib/utils/timeline-util';
|
||||||
|
import { AssetOrder } from '@immich/sdk';
|
||||||
import type { MonthGroup } from '../month-group.svelte';
|
import type { MonthGroup } from '../month-group.svelte';
|
||||||
import type { TimelineManager } from '../timeline-manager.svelte';
|
import type { TimelineManager } from '../timeline-manager.svelte';
|
||||||
import type { AssetDescriptor, Direction, TimelineAsset } from '../types';
|
import type { AssetDescriptor, Direction, TimelineAsset } from '../types';
|
||||||
@ -113,11 +114,10 @@ export async function retrieveRange(timelineManager: TimelineManager, start: Ass
|
|||||||
if (!endMonthGroup || !endAsset) {
|
if (!endMonthGroup || !endAsset) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
let direction: Direction = 'earlier';
|
const assetOrder: AssetOrder = timelineManager.getAssetOrder();
|
||||||
if (plainDateTimeCompare(true, startAsset.localDateTime, endAsset.localDateTime) < 0) {
|
if (plainDateTimeCompare(assetOrder === AssetOrder.Desc, startAsset.localDateTime, endAsset.localDateTime) < 0) {
|
||||||
[startAsset, endAsset] = [endAsset, startAsset];
|
[startAsset, endAsset] = [endAsset, startAsset];
|
||||||
[startMonthGroup, endMonthGroup] = [endMonthGroup, startMonthGroup];
|
[startMonthGroup, endMonthGroup] = [endMonthGroup, startMonthGroup];
|
||||||
direction = 'earlier';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const range: TimelineAsset[] = [];
|
const range: TimelineAsset[] = [];
|
||||||
@ -126,7 +126,6 @@ export async function retrieveRange(timelineManager: TimelineManager, start: Ass
|
|||||||
startMonthGroup,
|
startMonthGroup,
|
||||||
startDayGroup,
|
startDayGroup,
|
||||||
startAsset,
|
startAsset,
|
||||||
direction,
|
|
||||||
})) {
|
})) {
|
||||||
range.push(targetAsset);
|
range.push(targetAsset);
|
||||||
if (targetAsset.id === endAsset.id) {
|
if (targetAsset.id === endAsset.id) {
|
||||||
|
@ -540,4 +540,8 @@ export class TimelineManager {
|
|||||||
isMismatched(this.#options.isTrashed, asset.isTrashed)
|
isMismatched(this.#options.isTrashed, asset.isTrashed)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAssetOrder() {
|
||||||
|
return this.#options.order ?? AssetOrder.Desc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user