File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ class Gallery extends Component {
3838
3939 if ( this . state . images != np . images ) {
4040 this . setState ( {
41- images : np . images
41+ images : np . images ,
42+ thumbnails : this . renderThumbs ( this . _gallery . clientWidth , np . images )
4243 } ) ;
4344 }
4445 }
@@ -170,16 +171,16 @@ class Gallery extends Component {
170171 * ( item . thumbnailWidth / item . thumbnailHeight ) ) ;
171172 }
172173
173- renderThumbs ( containerWidth ) {
174- if ( ! this . state . images ) return [ ] ;
174+ renderThumbs ( containerWidth , images = this . state . images ) {
175+ if ( ! images ) return [ ] ;
175176 if ( containerWidth == 0 ) return [ ] ;
176177
177- var items = this . state . images . slice ( ) ;
178+ var items = images . slice ( ) ;
178179 for ( var t in items ) {
179180 this . setThumbScale ( items [ t ] ) ;
180181 }
181182
182- var images = [ ] ;
183+ var thumbs = [ ] ;
183184 var rows = [ ] ;
184185 while ( items . length > 0 ) {
185186 rows . push ( this . buildImageRow ( items , containerWidth ) ) ;
@@ -188,10 +189,10 @@ class Gallery extends Component {
188189 for ( var r in rows ) {
189190 for ( var i in rows [ r ] ) {
190191 var item = rows [ r ] [ i ] ;
191- images . push ( item ) ;
192+ thumbs . push ( item ) ;
192193 }
193194 }
194- return images ;
195+ return thumbs ;
195196 }
196197
197198 render ( ) {
You can’t perform that action at this time.
0 commit comments