fix: print sizing
This commit is contained in:
@@ -56,6 +56,11 @@ export interface DeckState {
|
||||
|
||||
// 打印状态
|
||||
isPrinting: boolean;
|
||||
|
||||
// 打印设置
|
||||
printOrientation: 'portrait' | 'landscape';
|
||||
printOddPageOffsetX: number;
|
||||
printOddPageOffsetY: number;
|
||||
}
|
||||
|
||||
export interface DeckActions {
|
||||
@@ -101,6 +106,11 @@ export interface DeckActions {
|
||||
// 打印操作
|
||||
setPrinting: (printing: boolean) => void;
|
||||
printDeck: () => void;
|
||||
|
||||
// 打印设置
|
||||
setPrintOrientation: (orientation: 'portrait' | 'landscape') => void;
|
||||
setPrintOddPageOffsetX: (offset: number) => void;
|
||||
setPrintOddPageOffsetY: (offset: number) => void;
|
||||
}
|
||||
|
||||
export interface DeckStore {
|
||||
@@ -136,7 +146,10 @@ export function createDeckStore(
|
||||
selectEnd: null,
|
||||
isLoading: false,
|
||||
error: null,
|
||||
isPrinting: false
|
||||
isPrinting: false,
|
||||
printOrientation: 'portrait',
|
||||
printOddPageOffsetX: 0,
|
||||
printOddPageOffsetY: 0
|
||||
});
|
||||
|
||||
// 更新尺寸并重新计算 dimensions
|
||||
@@ -279,6 +292,18 @@ export function createDeckStore(
|
||||
setState({ isPrinting: true });
|
||||
};
|
||||
|
||||
const setPrintOrientation = (orientation: 'portrait' | 'landscape') => {
|
||||
setState({ printOrientation: orientation });
|
||||
};
|
||||
|
||||
const setPrintOddPageOffsetX = (offset: number) => {
|
||||
setState({ printOddPageOffsetX: offset });
|
||||
};
|
||||
|
||||
const setPrintOddPageOffsetY = (offset: number) => {
|
||||
setState({ printOddPageOffsetY: offset });
|
||||
};
|
||||
|
||||
const actions: DeckActions = {
|
||||
setSizeW,
|
||||
setSizeH,
|
||||
@@ -306,7 +331,10 @@ export function createDeckStore(
|
||||
generateCode,
|
||||
copyCode,
|
||||
setPrinting,
|
||||
printDeck
|
||||
printDeck,
|
||||
setPrintOrientation,
|
||||
setPrintOddPageOffsetX,
|
||||
setPrintOddPageOffsetY
|
||||
};
|
||||
|
||||
return { state, actions };
|
||||
|
||||
Reference in New Issue
Block a user