feat: add justified layout modes and aspect-ratio-aware mosaic (#146)
- Add Flickr justified-layout and react-photo-album as masonry mode options - Implement aspect-ratio-aware mosaic layout that dynamically selects patterns based on photo orientations to minimize cropping - Add 9 mosaic pattern types optimized for different orientation combinations - Add theme customizer options for masonry mode selection (columns/rows/flickr/justified) - Add i18n translations for new layout options
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
declare module 'justified-layout' {
|
||||
interface JustifiedLayoutOptions {
|
||||
containerWidth: number;
|
||||
containerPadding?: number | { top: number; right: number; bottom: number; left: number };
|
||||
boxSpacing?: number | { horizontal: number; vertical: number };
|
||||
targetRowHeight?: number;
|
||||
targetRowHeightTolerance?: number;
|
||||
maxNumRows?: number;
|
||||
forceAspectRatio?: boolean | number;
|
||||
showWidows?: boolean;
|
||||
fullWidthBreakoutRowCadence?: boolean | number;
|
||||
widowLayoutStyle?: 'left' | 'center' | 'justify';
|
||||
}
|
||||
|
||||
interface Box {
|
||||
aspectRatio: number;
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
forcedAspectRatio?: boolean;
|
||||
}
|
||||
|
||||
interface JustifiedLayoutResult {
|
||||
containerHeight: number;
|
||||
widowCount: number;
|
||||
boxes: Box[];
|
||||
}
|
||||
|
||||
type InputItem = number | { width: number; height: number };
|
||||
|
||||
function justifiedLayout(
|
||||
input: InputItem[],
|
||||
options?: JustifiedLayoutOptions
|
||||
): JustifiedLayoutResult;
|
||||
|
||||
export = justifiedLayout;
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export interface GalleryLayoutSettings {
|
||||
};
|
||||
|
||||
// Masonry specific
|
||||
masonryMode?: 'columns' | 'rows'; // columns = Pinterest-style, rows = Google Photos-style
|
||||
masonryMode?: 'columns' | 'rows' | 'flickr' | 'justified'; // columns = Pinterest-style, rows = custom rows, flickr = Flickr justified-layout, justified = react-photo-album (Google Photos style)
|
||||
masonryGutter?: number;
|
||||
masonryRowHeight?: number; // Target row height for rows mode (150-400)
|
||||
masonryLastRowBehavior?: 'justify' | 'left' | 'center'; // How to align incomplete last row
|
||||
|
||||
Reference in New Issue
Block a user