excalidraw/src/types.ts
Jed Fox ab176937e6
Add touch support (#788)
* Add touch support

* Mock media query

* Mock media query pt 2

* Fix tests

* Allow installing as an app on iOS

* Fix type error

* Math.hypot

* delete and finalize buttons, hint viewer

* skip failing tests

* skip the rest of the failing tests

* Hide the selected shape actions when nothing is selected

* Don’t go into mobile view on short-but-wide viewports

* lol
2020-02-21 08:17:20 -05:00

49 lines
1.3 KiB
TypeScript

import { ExcalidrawElement } 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;
};
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;
};