feat: move contextMenu into the component tree and control via appState (#6021)

This commit is contained in:
David Luzar 2022-12-21 12:47:09 +01:00 committed by GitHub
parent b704705ed8
commit 7e135c4e22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1752 additions and 398 deletions

View file

@ -30,6 +30,7 @@ import { MaybeTransformHandleType } from "./element/transformHandles";
import Library from "./data/library";
import type { FileSystemHandle } from "./data/filesystem";
import type { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
import { ContextMenuItems } from "./components/ContextMenu";
export type Point = Readonly<RoughPoint>;
@ -92,6 +93,11 @@ export type LastActiveToolBeforeEraser =
| null;
export type AppState = {
contextMenu: {
items: ContextMenuItems;
top: number;
left: number;
} | null;
showWelcomeScreen: boolean;
isLoading: boolean;
errorMessage: string | null;
@ -147,6 +153,7 @@ export type AppState = {
isResizing: boolean;
isRotating: boolean;
zoom: Zoom;
// mobile-only
openMenu: "canvas" | "shape" | null;
openPopup:
| "canvasColorPicker"
@ -407,6 +414,7 @@ export type AppClassProperties = {
files: BinaryFiles;
device: App["device"];
scene: App["scene"];
pasteFromClipboard: App["pasteFromClipboard"];
};
export type PointerDownState = Readonly<{