mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
regression due to deferLayout
This commit is contained in:
parent
39d6de0f56
commit
efe0b73c48
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import DateInput from '$lib/components/elements/date-input.svelte';
|
||||||
|
import ConfirmDialog from '$lib/components/shared-components/dialog/confirm-dialog.svelte';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import DateInput from '../elements/date-input.svelte';
|
|
||||||
import ConfirmDialog from './dialog/confirm-dialog.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
initialDate?: DateTime;
|
initialDate?: DateTime;
|
||||||
|
@ -192,8 +192,8 @@ export class AssetDateGroup {
|
|||||||
return { moveAssets, processedIds, unprocessedIds, changedGeometry };
|
return { moveAssets, processedIds, unprocessedIds, changedGeometry };
|
||||||
}
|
}
|
||||||
|
|
||||||
layout(options: CommonLayoutOptions) {
|
layout(options: CommonLayoutOptions, noDefer: boolean) {
|
||||||
if (!this.bucket.intersecting) {
|
if (!noDefer && !this.bucket.intersecting) {
|
||||||
this.deferredLayout = true;
|
this.deferredLayout = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -497,10 +497,15 @@ export class AssetBucket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
findAssetAbsolutePosition(assetId: string) {
|
findAssetAbsolutePosition(assetId: string) {
|
||||||
|
this.store.clearDeferredLayout(this);
|
||||||
for (const group of this.dateGroups) {
|
for (const group of this.dateGroups) {
|
||||||
const intersectingAsset = group.intersetingAssets.find((asset) => asset.id === assetId);
|
const intersectingAsset = group.intersetingAssets.find((asset) => asset.id === assetId);
|
||||||
if (intersectingAsset) {
|
if (intersectingAsset) {
|
||||||
return this.top + group.top + intersectingAsset.position!.top + this.store.headerHeight;
|
if (!intersectingAsset.position) {
|
||||||
|
console.warn('No position for asset');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this.top + group.top + intersectingAsset.position.top + this.store.headerHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -862,6 +867,16 @@ export class AssetStore {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearDeferredLayout(bucket: AssetBucket) {
|
||||||
|
const hasDeferred = bucket.dateGroups.some((group) => group.deferredLayout);
|
||||||
|
if (hasDeferred) {
|
||||||
|
this.#updateGeometry(bucket, true, true);
|
||||||
|
for (const group of bucket.dateGroups) {
|
||||||
|
group.deferredLayout = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#updateIntersection(bucket: AssetBucket) {
|
#updateIntersection(bucket: AssetBucket) {
|
||||||
const actuallyIntersecting = this.#calculateIntersecting(bucket, 0, 0);
|
const actuallyIntersecting = this.#calculateIntersecting(bucket, 0, 0);
|
||||||
let preIntersecting = false;
|
let preIntersecting = false;
|
||||||
@ -871,13 +886,7 @@ export class AssetStore {
|
|||||||
bucket.intersecting = actuallyIntersecting || preIntersecting;
|
bucket.intersecting = actuallyIntersecting || preIntersecting;
|
||||||
bucket.actuallyIntersecting = actuallyIntersecting;
|
bucket.actuallyIntersecting = actuallyIntersecting;
|
||||||
if (preIntersecting || actuallyIntersecting) {
|
if (preIntersecting || actuallyIntersecting) {
|
||||||
const hasDeferred = bucket.dateGroups.some((group) => group.deferredLayout);
|
this.clearDeferredLayout(bucket);
|
||||||
if (hasDeferred) {
|
|
||||||
this.#updateGeometry(bucket, true);
|
|
||||||
for (const group of bucket.dateGroups) {
|
|
||||||
group.deferredLayout = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1009,7 +1018,7 @@ export class AssetStore {
|
|||||||
rowWidth: Math.floor(viewportWidth),
|
rowWidth: Math.floor(viewportWidth),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#updateGeometry(bucket: AssetBucket, invalidateHeight: boolean) {
|
#updateGeometry(bucket: AssetBucket, invalidateHeight: boolean, noDefer: boolean = false) {
|
||||||
if (invalidateHeight) {
|
if (invalidateHeight) {
|
||||||
bucket.isBucketHeightActual = false;
|
bucket.isBucketHeightActual = false;
|
||||||
}
|
}
|
||||||
@ -1024,10 +1033,10 @@ export class AssetStore {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.#layoutBucket(bucket);
|
this.#layoutBucket(bucket, noDefer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#layoutBucket(bucket: AssetBucket) {
|
#layoutBucket(bucket: AssetBucket, noDefer: boolean = false) {
|
||||||
// these are top offsets, for each row
|
// these are top offsets, for each row
|
||||||
let cummulativeHeight = 0;
|
let cummulativeHeight = 0;
|
||||||
// these are left offsets of each group, for each row
|
// these are left offsets of each group, for each row
|
||||||
@ -1042,7 +1051,7 @@ export class AssetStore {
|
|||||||
rowSpaceRemaining.fill(this.viewportWidth, 0, bucket.dateGroups.length);
|
rowSpaceRemaining.fill(this.viewportWidth, 0, bucket.dateGroups.length);
|
||||||
const options = this.createLayoutOptions();
|
const options = this.createLayoutOptions();
|
||||||
for (const assetGroup of bucket.dateGroups) {
|
for (const assetGroup of bucket.dateGroups) {
|
||||||
assetGroup.layout(options);
|
assetGroup.layout(options, noDefer);
|
||||||
rowSpaceRemaining[dateGroupRow] -= assetGroup.width - 1;
|
rowSpaceRemaining[dateGroupRow] -= assetGroup.width - 1;
|
||||||
if (dateGroupCol > 0) {
|
if (dateGroupCol > 0) {
|
||||||
rowSpaceRemaining[dateGroupRow] -= this.gap;
|
rowSpaceRemaining[dateGroupRow] -= this.gap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user