@@ -92,6 +92,7 @@ export class Thumbnail extends Component<ThumbnailProps, ThumbnailState> {
9292
9393 private _onLoaded ( ) {
9494 const { loading, error } = this . $state ;
95+ this . _resize ( ) ;
9596 loading . set ( false ) ;
9697 error . set ( null ) ;
9798 }
@@ -124,9 +125,11 @@ export class Thumbnail extends Component<ThumbnailProps, ThumbnailState> {
124125 }
125126
126127 private _onFindActiveThumbnail ( ) {
128+ let images = this . _loader . $images ( ) ;
129+ if ( ! images . length ) return ;
130+
127131 let time = this . _getTime ( ) ,
128132 { src, activeThumbnail } = this . $state ,
129- images = this . _loader . $images ( ) ,
130133 activeIndex = - 1 ,
131134 activeImage : ThumbnailImage | null = null ;
132135
@@ -147,14 +150,13 @@ export class Thumbnail extends Component<ThumbnailProps, ThumbnailState> {
147150 }
148151
149152 private _resize ( ) {
150- if ( ! this . scope ) return ;
153+ if ( ! this . scope || this . $state . hidden ( ) ) return ;
151154
152155 const rootEl = this . el ,
153156 imgEl = this . $state . img ( ) ,
154- loading = this . $state . loading ( ) ,
155157 thumbnail = this . $state . activeThumbnail ( ) ;
156158
157- if ( ! imgEl || ! thumbnail || ! rootEl || loading ) return ;
159+ if ( ! imgEl || ! thumbnail || ! rootEl ) return ;
158160
159161 let width = thumbnail . width ?? imgEl . naturalWidth ,
160162 height = thumbnail ?. height ?? imgEl . naturalHeight ,
0 commit comments