refactor: sizing

This commit is contained in:
2026-03-15 10:14:14 +08:00
parent 8d8d4d004e
commit 57d2a7ed46
3 changed files with 72 additions and 15 deletions
+13 -1
View File
@@ -178,7 +178,19 @@ export function calculateSinglePageLayout(options: LayoutOptions): SinglePageLay
a4Height,
cardsPerRow,
rowsPerPage,
cardsPerPage
cardsPerPage,
frameBounds: {
minX: offsetX,
minY: offsetY,
maxX: offsetX + maxGridWidth,
maxY: offsetY + maxGridHeight
},
frameBoundsWithMargin: {
x: offsetX - 1,
y: offsetY - 1,
width: maxGridWidth + 2,
height: maxGridHeight + 2
}
};
}
+24
View File
@@ -1,3 +1,23 @@
/**
* 边界框
*/
export interface Bounds {
minX: number;
minY: number;
maxX: number;
maxY: number;
}
/**
* 带边距的边界框(用于裁切标记)
*/
export interface BoundsWithMargin {
x: number;
y: number;
width: number;
height: number;
}
/**
* 卡片形状类型
*/
@@ -53,6 +73,10 @@ export interface SinglePageLayout {
rowsPerPage: number;
/** 每页总卡片数 */
cardsPerPage: number;
/** 排版区域边界框 */
frameBounds: Bounds;
/** 带边距的边界框(用于裁切标记) */
frameBoundsWithMargin: BoundsWithMargin;
}
/**