@@ -99,8 +99,8 @@ class ThumbnailsView: NSVisualEffectView {
9999
100100    func  updateItemsAndLayout( _ screen:  NSScreen )  { 
101101        let  widthMax  =  ThumbnailsPanel . maxThumbnailsWidth ( screen) . rounded ( ) 
102-         if  let  ( maxX,  maxY)  =  layoutThumbnailViews ( screen,  widthMax)  { 
103-             layoutParentViews ( screen,  maxX,  widthMax,  maxY) 
102+         if  let  ( maxX,  maxY,  labelHeight )  =  layoutThumbnailViews ( screen,  widthMax)  { 
103+             layoutParentViews ( screen,  maxX,  widthMax,  maxY,  labelHeight ) 
104104            if  Preferences . alignThumbnails ==  . center { 
105105                centerRows ( maxX) 
106106            } 
@@ -116,8 +116,9 @@ class ThumbnailsView: NSVisualEffectView {
116116        } 
117117    } 
118118
119-     private  func  layoutThumbnailViews( _ screen:  NSScreen ,  _ widthMax:  CGFloat )  ->  ( CGFloat ,  CGFloat ) ? { 
120-         let  height  =  ThumbnailView . height ( screen) 
119+     private  func  layoutThumbnailViews( _ screen:  NSScreen ,  _ widthMax:  CGFloat )  ->  ( CGFloat ,  CGFloat ,  CGFloat ) ? { 
120+         let  labelHeight  =  ThumbnailsView . recycledViews. first!. label. cell!. cellSize. height
121+         let  height  =  ThumbnailView . height ( screen,  labelHeight) 
121122        let  isLeftToRight  =  App . shared. userInterfaceLayoutDirection ==  . leftToRight
122123        let  startingX  =  isLeftToRight ?  Appearance . interCellPadding :  widthMax -  Appearance. interCellPadding
123124        var  currentX  =  startingX
@@ -151,7 +152,7 @@ class ThumbnailsView: NSVisualEffectView {
151152            window. rowIndex =  rows. count -  1 
152153        } 
153154        scrollView. documentView!. subviews =  newViews
154-         return  ( maxX,  maxY) 
155+         return  ( maxX,  maxY,  labelHeight ) 
155156    } 
156157
157158    private  func  needNewLine( _ projectedX:  CGFloat ,  _ widthMax:  CGFloat )  ->  Bool  { 
@@ -172,7 +173,7 @@ class ThumbnailsView: NSVisualEffectView {
172173        App . shared. userInterfaceLayoutDirection ==  . leftToRight ?  currentX :  currentX -  width
173174    } 
174175
175-     private  func  layoutParentViews( _ screen:  NSScreen ,  _ maxX:  CGFloat ,  _ widthMax:  CGFloat ,  _ maxY:  CGFloat )  { 
176+     private  func  layoutParentViews( _ screen:  NSScreen ,  _ maxX:  CGFloat ,  _ widthMax:  CGFloat ,  _ maxY:  CGFloat ,  _ labelHeight :   CGFloat )  { 
176177        let  heightMax  =  ThumbnailsPanel . maxThumbnailsHeight ( screen) . rounded ( ) 
177178
178179        ThumbnailsView . thumbnailsWidth =  min ( maxX,  widthMax) 
@@ -183,8 +184,8 @@ class ThumbnailsView: NSVisualEffectView {
183184        var  originY  =  Appearance . windowPadding
184185        if  Preferences . appearanceStyle ==  . appIcons { 
185186            // If there is title under the icon on the last line, the height of the title needs to be subtracted.
186-             frameHeight =  frameHeight -  Appearance. intraCellPadding -  ThumbnailTitleView . maxHeight ( ) 
187-             originY =  originY -  Appearance. intraCellPadding -  ThumbnailTitleView . maxHeight ( ) 
187+             frameHeight =  frameHeight -  Appearance. intraCellPadding -  labelHeight 
188+             originY =  originY -  Appearance. intraCellPadding -  labelHeight 
188189        } 
189190        frame. size =  NSSize ( width:  frameWidth,  height:  frameHeight) 
190191
0 commit comments