excalidraw/packages/excalidraw/element/showSelectedShapeActions.ts
Ryan Di 5e1ff7cafe
perf: improve new element drawing (#8340)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2024-08-23 20:27:57 +02:00

18 lines
685 B
TypeScript

import type { NonDeletedExcalidrawElement } from "./types";
import { getSelectedElements } from "../scene";
import type { UIAppState } from "../types";
export const showSelectedShapeActions = (
appState: UIAppState,
elements: readonly NonDeletedExcalidrawElement[],
) =>
Boolean(
!appState.viewModeEnabled &&
((appState.activeTool.type !== "custom" &&
(appState.editingTextElement ||
(appState.activeTool.type !== "selection" &&
appState.activeTool.type !== "eraser" &&
appState.activeTool.type !== "hand" &&
appState.activeTool.type !== "laser"))) ||
getSelectedElements(elements, appState).length),
);