41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
|
|
export type TextAlign = 'left' | 'center' | 'right';
|
||
|
|
export type TextBaseline = 'top' | 'middle' | 'bottom' | 'alphabetic';
|
||
|
|
export type FontStyle = 'normal' | 'italic';
|
||
|
|
export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
||
|
|
|
||
|
|
export interface TextSettings {
|
||
|
|
text: string;
|
||
|
|
fontFamily: string;
|
||
|
|
fontSize: number;
|
||
|
|
fontStyle: FontStyle;
|
||
|
|
fontWeight: FontWeight;
|
||
|
|
color: string;
|
||
|
|
align: TextAlign;
|
||
|
|
baseline: TextBaseline;
|
||
|
|
lineHeight: number;
|
||
|
|
letterSpacing: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface TextStore {
|
||
|
|
settings: TextSettings;
|
||
|
|
isDialogOpen: boolean;
|
||
|
|
clickPosition: { x: number; y: number } | null;
|
||
|
|
|
||
|
|
// Setters
|
||
|
|
setText: (text: string) => void;
|
||
|
|
setFontFamily: (fontFamily: string) => void;
|
||
|
|
setFontSize: (fontSize: number) => void;
|
||
|
|
setFontStyle: (fontStyle: FontStyle) => void;
|
||
|
|
setFontWeight: (fontWeight: FontWeight) => void;
|
||
|
|
setColor: (color: string) => void;
|
||
|
|
setAlign: (align: TextAlign) => void;
|
||
|
|
setBaseline: (baseline: TextBaseline) => void;
|
||
|
|
setLineHeight: (lineHeight: number) => void;
|
||
|
|
setLetterSpacing: (letterSpacing: number) => void;
|
||
|
|
updateSettings: (settings: Partial<TextSettings>) => void;
|
||
|
|
|
||
|
|
// Dialog control
|
||
|
|
openDialog: (x: number, y: number) => void;
|
||
|
|
closeDialog: () => void;
|
||
|
|
}
|