Revision: 29118 http://sourceforge.net/p/bibdesk/svn/29118 Author: hofman Date: 2025-04-17 14:29:18 +0000 (Thu, 17 Apr 2025) Log Message: ----------- Update comments. Make sure icon size is integral in column or row mode.
Modified Paths: -------------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-17 09:45:20 UTC (rev 29117) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-17 14:29:18 UTC (rev 29118) @@ -1221,24 +1221,26 @@ } - (void)_setPaddingAndIconSizeFromContentWidth:(CGFloat)width { + // calculate the column width, inverting the calculation in _frameWidth // make sure fractional widths won't bring back scrollers CGFloat colWidth = ( floor(width) - 2 * DEFAULT_MARGIN.width ) / _numberOfColumns; - // guess the iconScale, ignoring the variable padding because that depends on the iconScale + // guess the iconScale, ignoring the rounding of the variable padding as that can't be inverted CGFloat iconScale = fmax( MIN_AUTO_ICON_SCALE, ( colWidth - DEFAULT_PADDING.width ) / ( DEFAULT_ICON_SIZE.width + PADDING_STRETCH )); _padding = [self _paddingForScale:iconScale]; - // recalculate exactly based on this padding, inverting the calculation in _frameWidth - iconScale = fmax( MIN_AUTO_ICON_SCALE, ( colWidth - _padding.width ) / DEFAULT_ICON_SIZE.width ); + // recalculate exactly based on this padding + iconScale = fmax( MIN_AUTO_ICON_SCALE, floor( colWidth - _padding.width ) / DEFAULT_ICON_SIZE.width ); _iconSize = NSMakeSize(iconScale * DEFAULT_ICON_SIZE.width, iconScale * DEFAULT_ICON_SIZE.height); } - (void)_setPaddingAndIconSizeFromContentHeight:(CGFloat)height { + // calculate the row height, inverting the calculation in _frameHeight // make sure fractional heights won't bring back scrollers - CGFloat colHeight = ( floor(height) - DEFAULT_MARGIN.height ) / _numberOfRows; - // guess the iconScale, ignoring the variable padding because that depends on the iconScale - CGFloat iconScale = fmax( MIN_AUTO_ICON_SCALE, ( colHeight - DEFAULT_PADDING.height - [self _textHeight] ) / ( DEFAULT_ICON_SIZE.height + PADDING_STRETCH ) ); + CGFloat rowHeight = ( floor(height) - DEFAULT_MARGIN.height ) / _numberOfRows; + // guess the iconScale, ignoring the rounding of the variable padding as that can't be inverted + CGFloat iconScale = fmax( MIN_AUTO_ICON_SCALE, ( rowHeight - DEFAULT_PADDING.height - [self _textHeight] ) / ( DEFAULT_ICON_SIZE.height + PADDING_STRETCH ) ); _padding = [self _paddingForScale:iconScale]; // recalculate exactly based on this padding, inverting the calculation in _frameHeight - iconScale = fmax( MIN_AUTO_ICON_SCALE, ( colHeight - _padding.height ) / DEFAULT_ICON_SIZE.height ); + iconScale = fmax( MIN_AUTO_ICON_SCALE, floor( rowHeight - _padding.height ) / DEFAULT_ICON_SIZE.height ); _iconSize = NSMakeSize(iconScale * DEFAULT_ICON_SIZE.width, iconScale * DEFAULT_ICON_SIZE.height); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit