mirror of
https://github.com/immich-app/immich.git
synced 2025-07-03 21:40:00 +02:00
feat: timeline performance (#16446)
* Squash - feature complete * remove need to init assetstore * More optimizations. No need to init. Fix tests * lint * add missing selector for e2e * e2e selectors again * Update: fully reactive store, some transitions, bugfixes * merge fallout * Test fallout * safari quirk * security * lint * lint * Bug fixes * lint/format * accidental commit * lock * null check, more throttle * revert long duration * Fix intersection bounds * Fix bugs in intersection calculation * lint, tweak scrubber ui a tiny bit * bugfix - deselecting asset doesnt work * fix not loading bucket, scroll off-by-1 error, jsdoc, naming
This commit is contained in:
parent
dd263b010c
commit
e96ffd43e7
48 changed files with 2318 additions and 2764 deletions
web/src/lib/utils
|
@ -49,18 +49,21 @@ export function getJustifiedLayoutFromAssets(
|
|||
type Geometry = ReturnType<typeof createJustifiedLayout>;
|
||||
class Adapter {
|
||||
result;
|
||||
width;
|
||||
constructor(result: Geometry) {
|
||||
this.result = result;
|
||||
this.width = 0;
|
||||
for (const box of this.result.boxes) {
|
||||
if (box.top < 100) {
|
||||
this.width = box.left + box.width;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get containerWidth() {
|
||||
let width = 0;
|
||||
for (const box of this.result.boxes) {
|
||||
if (box.top < 100) {
|
||||
width = box.left + box.width;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
return this.width;
|
||||
}
|
||||
|
||||
get containerHeight() {
|
||||
|
@ -84,12 +87,6 @@ class Adapter {
|
|||
}
|
||||
}
|
||||
|
||||
export const emptyGeometry = new Adapter({
|
||||
containerHeight: 0,
|
||||
widowCount: 0,
|
||||
boxes: [],
|
||||
});
|
||||
|
||||
export function justifiedLayout(assets: AssetResponseDto[], options: CommonLayoutOptions) {
|
||||
const adapter = {
|
||||
targetRowHeight: options.rowHeight,
|
||||
|
@ -104,3 +101,26 @@ export function justifiedLayout(assets: AssetResponseDto[], options: CommonLayou
|
|||
);
|
||||
return new Adapter(result);
|
||||
}
|
||||
|
||||
export const emptyGeometry = () =>
|
||||
new Adapter({
|
||||
containerHeight: 0,
|
||||
widowCount: 0,
|
||||
boxes: [],
|
||||
});
|
||||
|
||||
export type CommonPosition = {
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
export function getPosition(geometry: CommonJustifiedLayout, boxIdx: number): CommonPosition {
|
||||
const top = geometry.getTop(boxIdx);
|
||||
const left = geometry.getLeft(boxIdx);
|
||||
const width = geometry.getWidth(boxIdx);
|
||||
const height = geometry.getHeight(boxIdx);
|
||||
|
||||
return { top, left, width, height };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue