/** 图库展示方式;仅改变卡片排版,不影响素材顺序、筛选及后端查询。 */ export type GalleryLayout = 'grid' | 'masonry' /** * 计算瀑布流卡片需要跨越的网格行数。 * @param height 卡片实际高度 * @param rowHeight 隐式网格行高 * @param rowGap 网格行间距 * @returns 卡片需要跨越的网格行数 */ export function masonryRowSpan(height: number, rowHeight: number, rowGap: number): number { if (![height, rowHeight, rowGap].every(Number.isFinite) || height <= 0 || rowHeight <= 0 || rowGap < 0) return 1 return Math.max(1, Math.ceil((height + rowGap) / (rowHeight + rowGap))) }