excalidraw/src/types.ts
Jed Fox 8e0206cc1e
Undo/Redo buttons, refactor menu toggles (#793)
* Make Undo & Redo and the menu buttons into actions; add undo/redo buttons

* Create variables for the ToolIcon colors

* Darken the menu buttons when they’re active

* Put the more intensive test in `perform`

* Fix & restyle hint viewer

* Add pinch zoom for macOS Safari

* Chrome/Firefox trackpad pinch zoom

* openedMenu → openMenu

* needsShapeEditor.ts → showSelectedShapeActions.ts

* Call showSelectedShapeActions
2020-03-01 20:39:03 +01:00

55 lines
1.5 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;
openMenu: "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;
};
export declare class GestureEvent extends UIEvent {
readonly rotation: number;
readonly scale: number;
}