* Disable text selection * Set content-editable=plaintext-only to disable Touch Bar formatting buttons * Enlarge resize handle tap targets for pen/touch * Make the lock button a button in mobile mode * Use icons instead of Unicode characters; add an alternate toolbar for creating multipoint lines * Allow buttons to hide themselves * Fix heuristic for showing shape actions * Refactor icons * Fix label for edit button * Switch edit button icon * Remove lock button on mobile * Add language selector on mobile * Fix showing edit button on mobile * Fix showing edit button on mobile, part 2 * Fix handle touch regions * Fix scroll-back button position * Allow using the text tool on a text object to start editing it * Fix deletion of last point in line
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { ExcalidrawElement, PointerType } from "./element/types";
|
|
import { SHAPES } from "./shapes";
|
|
|
|
export type FlooredNumber = number & { _brand: "FlooredNumber" };
|
|
|
|
export type AppState = {
|
|
draggingElement: ExcalidrawElement | null;
|
|
resizingElement: ExcalidrawElement | null;
|
|
multiElement: ExcalidrawElement | null;
|
|
selectionElement: ExcalidrawElement | null;
|
|
// element being edited, but not necessarily added to elements array yet
|
|
// (e.g. text element when typing into the input)
|
|
editingElement: ExcalidrawElement | null;
|
|
elementType: typeof SHAPES[number]["value"];
|
|
elementLocked: boolean;
|
|
exportBackground: boolean;
|
|
currentItemStrokeColor: string;
|
|
currentItemBackgroundColor: string;
|
|
currentItemFillStyle: string;
|
|
currentItemStrokeWidth: number;
|
|
currentItemRoughness: number;
|
|
currentItemOpacity: number;
|
|
currentItemFont: string;
|
|
viewBackgroundColor: string;
|
|
scrollX: FlooredNumber;
|
|
scrollY: FlooredNumber;
|
|
cursorX: number;
|
|
cursorY: number;
|
|
scrolledOutside: boolean;
|
|
name: string;
|
|
selectedId?: string;
|
|
isResizing: boolean;
|
|
zoom: number;
|
|
openedMenu: "canvas" | "shape" | null;
|
|
lastPointerDownWith: PointerType;
|
|
};
|
|
|
|
export type Pointer = Readonly<{
|
|
id: number;
|
|
x: number;
|
|
y: number;
|
|
}>;
|
|
|
|
export type Gesture = {
|
|
pointers: Array<Pointer>;
|
|
lastCenter: { x: number; y: number } | null;
|
|
initialDistance: number | null;
|
|
initialScale: number | null;
|
|
};
|