
* feat: add the ability to change the alignement of the text * test: update the snapshots to included the newely textAlign state * style: use explicit key assignment to object * test: add missing new key textAlign to newElement.test.ts * style: make the text on the buttons start with uppercase * Update src/locales/en.json * add types * add migration * remove incorrect update Co-authored-by: Youness Fkhach <younessfkhach@porotonmail.com> Co-authored-by: Lipis <lipiridis@gmail.com> Co-authored-by: dwelle <luzar.david@gmail.com>
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import { Point } from "../types";
|
|
|
|
type _ExcalidrawElementBase = Readonly<{
|
|
id: string;
|
|
x: number;
|
|
y: number;
|
|
strokeColor: string;
|
|
backgroundColor: string;
|
|
fillStyle: string;
|
|
strokeWidth: number;
|
|
roughness: number;
|
|
opacity: number;
|
|
width: number;
|
|
height: number;
|
|
angle: number;
|
|
seed: number;
|
|
version: number;
|
|
versionNonce: number;
|
|
isDeleted: boolean;
|
|
}>;
|
|
|
|
export type ExcalidrawGenericElement = _ExcalidrawElementBase & {
|
|
type: "selection" | "rectangle" | "diamond" | "ellipse";
|
|
};
|
|
|
|
/**
|
|
* ExcalidrawElement should be JSON serializable and (eventually) contain
|
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
* between peers and contain no state local to the peer.
|
|
*/
|
|
export type ExcalidrawElement =
|
|
| ExcalidrawGenericElement
|
|
| ExcalidrawTextElement
|
|
| ExcalidrawLinearElement;
|
|
|
|
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
isDeleted: false;
|
|
};
|
|
|
|
export type NonDeletedExcalidrawElement = NonDeleted<ExcalidrawElement>;
|
|
|
|
export type ExcalidrawTextElement = _ExcalidrawElementBase &
|
|
Readonly<{
|
|
type: "text";
|
|
font: string;
|
|
text: string;
|
|
baseline: number;
|
|
textAlign: TextAlign;
|
|
}>;
|
|
|
|
export type ExcalidrawLinearElement = _ExcalidrawElementBase &
|
|
Readonly<{
|
|
type: "arrow" | "line";
|
|
points: Point[];
|
|
lastCommittedPoint?: Point | null;
|
|
}>;
|
|
|
|
export type PointerType = "mouse" | "pen" | "touch";
|
|
|
|
export type TextAlign = "left" | "center" | "right";
|