@@ -32,7 +32,9 @@ export type AssetStoreOptions = Omit<AssetApiGetTimeBucketsRequest, 'size'> & {
32
32
timelineAlbumId ?: string ;
33
33
deferInit ?: boolean ;
34
34
} ;
35
-
35
+ export type AssetStoreLayoutOptions = {
36
+ rowHeight : number ;
37
+ } ;
36
38
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37
39
function updateObject ( target : any , source : any ) : boolean {
38
40
if ( ! target ) {
@@ -559,6 +561,7 @@ export class AssetStore {
559
561
560
562
// --- private
561
563
static #INIT_OPTIONS = { } ;
564
+ #rowHeight = 235 ;
562
565
#viewportHeight = $state ( 0 ) ;
563
566
#viewportWidth = $state ( 0 ) ;
564
567
#scrollTop = $state ( 0 ) ;
@@ -601,6 +604,7 @@ export class AssetStore {
601
604
const changed = value !== this . #viewportWidth;
602
605
this . #viewportWidth = value ;
603
606
this . suspendTransitions = true ;
607
+ this . #rowHeight = value < 850 ? 100 : 235 ;
604
608
// side-effect - its ok!
605
609
void this . #updateViewportGeometry( changed ) ;
606
610
}
@@ -776,6 +780,11 @@ export class AssetStore {
776
780
this . #updateViewportGeometry( false ) ;
777
781
}
778
782
783
+ updateLayoutOptions ( options : AssetStoreLayoutOptions ) {
784
+ this . #rowHeight = options . rowHeight ;
785
+ this . refreshLayout ( ) ;
786
+ }
787
+
779
788
async #init( options : AssetStoreOptions ) {
780
789
// doing the following outside of the task reduces flickr
781
790
this . isInitialized = false ;
@@ -845,10 +854,11 @@ export class AssetStore {
845
854
846
855
createLayoutOptions ( ) {
847
856
const viewportWidth = this . viewportWidth ;
857
+
848
858
return {
849
859
spacing : 2 ,
850
860
heightTolerance : 0.15 ,
851
- rowHeight : 235 ,
861
+ rowHeight : this . #rowHeight ,
852
862
rowWidth : Math . floor ( viewportWidth ) ,
853
863
} ;
854
864
}
0 commit comments