|
|
|
@ -1,7 +1,6 @@
|
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
|
|
|
import { getKey } from '$lib/utils';
|
|
|
|
import { getKey } from '$lib/utils';
|
|
|
|
import { AssetGridTaskManager } from '$lib/utils/asset-store-task-manager';
|
|
|
|
import { AssetGridTaskManager } from '$lib/utils/asset-store-task-manager';
|
|
|
|
import { getJustifiedLayoutFromAssets } from '$lib/utils/asset-utils';
|
|
|
|
|
|
|
|
import { generateId } from '$lib/utils/generate-id';
|
|
|
|
import { generateId } from '$lib/utils/generate-id';
|
|
|
|
import type { AssetGridRouteSearchParams } from '$lib/utils/navigation';
|
|
|
|
import type { AssetGridRouteSearchParams } from '$lib/utils/navigation';
|
|
|
|
import { fromLocalDateTime, splitBucketIntoDateGroups, type DateGroup } from '$lib/utils/timeline-util';
|
|
|
|
import { fromLocalDateTime, splitBucketIntoDateGroups, type DateGroup } from '$lib/utils/timeline-util';
|
|
|
|
@ -436,7 +435,7 @@ export class AssetStore {
|
|
|
|
|
|
|
|
|
|
|
|
private async initialLayout(changedWidth: boolean) {
|
|
|
|
private async initialLayout(changedWidth: boolean) {
|
|
|
|
for (const bucket of this.buckets) {
|
|
|
|
for (const bucket of this.buckets) {
|
|
|
|
this.updateGeometry(bucket, changedWidth);
|
|
|
|
await this.updateGeometry(bucket, changedWidth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.timelineHeight = this.buckets.reduce((accumulator, b) => accumulator + b.bucketHeight, 0);
|
|
|
|
this.timelineHeight = this.buckets.reduce((accumulator, b) => accumulator + b.bucketHeight, 0);
|
|
|
|
|
|
|
|
|
|
|
|
@ -454,7 +453,7 @@ export class AssetStore {
|
|
|
|
this.emit(false);
|
|
|
|
this.emit(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private updateGeometry(bucket: AssetBucket, invalidateHeight: boolean) {
|
|
|
|
private async updateGeometry(bucket: AssetBucket, invalidateHeight: boolean) {
|
|
|
|
if (invalidateHeight) {
|
|
|
|
if (invalidateHeight) {
|
|
|
|
bucket.isBucketHeightActual = false;
|
|
|
|
bucket.isBucketHeightActual = false;
|
|
|
|
bucket.measured = false;
|
|
|
|
bucket.measured = false;
|
|
|
|
@ -477,6 +476,8 @@ export class AssetStore {
|
|
|
|
rowHeight: 235,
|
|
|
|
rowHeight: 235,
|
|
|
|
rowWidth: Math.floor(viewportWidth),
|
|
|
|
rowWidth: Math.floor(viewportWidth),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: move this import and make this method sync after https://github.com/sveltejs/kit/issues/7805 is fixed
|
|
|
|
|
|
|
|
const { getJustifiedLayoutFromAssets } = await import('$lib/utils/layout-utils');
|
|
|
|
for (const assetGroup of bucket.dateGroups) {
|
|
|
|
for (const assetGroup of bucket.dateGroups) {
|
|
|
|
if (!assetGroup.heightActual) {
|
|
|
|
if (!assetGroup.heightActual) {
|
|
|
|
const unwrappedWidth = (3 / 2) * assetGroup.assets.length * THUMBNAIL_HEIGHT * (7 / 10);
|
|
|
|
const unwrappedWidth = (3 / 2) * assetGroup.assets.length * THUMBNAIL_HEIGHT * (7 / 10);
|
|
|
|
@ -552,7 +553,7 @@ export class AssetStore {
|
|
|
|
bucket.assets = assets;
|
|
|
|
bucket.assets = assets;
|
|
|
|
bucket.dateGroups = splitBucketIntoDateGroups(bucket, get(locale));
|
|
|
|
bucket.dateGroups = splitBucketIntoDateGroups(bucket, get(locale));
|
|
|
|
this.maxBucketAssets = Math.max(this.maxBucketAssets, assets.length);
|
|
|
|
this.maxBucketAssets = Math.max(this.maxBucketAssets, assets.length);
|
|
|
|
this.updateGeometry(bucket, true);
|
|
|
|
await this.updateGeometry(bucket, true);
|
|
|
|
this.timelineHeight = this.buckets.reduce((accumulator, b) => accumulator + b.bucketHeight, 0);
|
|
|
|
this.timelineHeight = this.buckets.reduce((accumulator, b) => accumulator + b.bucketHeight, 0);
|
|
|
|
bucket.loaded();
|
|
|
|
bucket.loaded();
|
|
|
|
this.notifyListeners({ type: 'loaded', bucket });
|
|
|
|
this.notifyListeners({ type: 'loaded', bucket });
|
|
|
|
@ -679,7 +680,7 @@ export class AssetStore {
|
|
|
|
return bDate.diff(aDate).milliseconds;
|
|
|
|
return bDate.diff(aDate).milliseconds;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
bucket.dateGroups = splitBucketIntoDateGroups(bucket, get(locale));
|
|
|
|
bucket.dateGroups = splitBucketIntoDateGroups(bucket, get(locale));
|
|
|
|
this.updateGeometry(bucket, true);
|
|
|
|
void this.updateGeometry(bucket, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.emit(true);
|
|
|
|
this.emit(true);
|
|
|
|
@ -821,7 +822,7 @@ export class AssetStore {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed) {
|
|
|
|
if (changed) {
|
|
|
|
bucket.dateGroups = splitBucketIntoDateGroups(bucket, get(locale));
|
|
|
|
bucket.dateGroups = splitBucketIntoDateGroups(bucket, get(locale));
|
|
|
|
this.updateGeometry(bucket, true);
|
|
|
|
void this.updateGeometry(bucket, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|