mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-19 07:20:21 +02:00

* Revert "Revert "Feature: Multi Point Arrows (#338)" (#634)"
This reverts commit 3d2e59bfed
.
* Convert old arrow spec to new one
* Remove unnecessary failchecks and fix context transform issue in retina displays
* Remove old points failcheck from getArrowAbsoluteBounds
* Remove all failchecks for old arrow
* remove the rest of unnecessary checks
* Set default values for the arrow during import
* Add translations
* fix restore using unmigrated elements for state computation
* don't use width/height when migrating from new arrow spec
Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
import React from "react";
|
|
import { ExcalidrawElement } from "../element/types";
|
|
import { AppState } from "../types";
|
|
|
|
export type ActionResult = {
|
|
elements?: ExcalidrawElement[];
|
|
appState?: AppState;
|
|
};
|
|
|
|
type ActionFn = (
|
|
elements: readonly ExcalidrawElement[],
|
|
appState: AppState,
|
|
formData: any,
|
|
) => ActionResult;
|
|
|
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
export type ActionFilterFn = (action: Action) => void;
|
|
|
|
export interface Action {
|
|
name: string;
|
|
PanelComponent?: React.FC<{
|
|
elements: readonly ExcalidrawElement[];
|
|
appState: AppState;
|
|
updateData: (formData: any) => void;
|
|
}>;
|
|
perform: ActionFn;
|
|
keyPriority?: number;
|
|
keyTest?: (
|
|
event: KeyboardEvent,
|
|
appState: AppState,
|
|
elements: readonly ExcalidrawElement[],
|
|
) => boolean;
|
|
contextItemLabel?: string;
|
|
contextMenuOrder?: number;
|
|
}
|
|
|
|
export interface ActionsManagerInterface {
|
|
actions: {
|
|
[keyProp: string]: Action;
|
|
};
|
|
registerAction: (action: Action) => void;
|
|
handleKeyDown: (
|
|
event: KeyboardEvent,
|
|
elements: readonly ExcalidrawElement[],
|
|
appState: AppState,
|
|
) => ActionResult | null;
|
|
getContextMenuItems: (
|
|
elements: readonly ExcalidrawElement[],
|
|
appState: AppState,
|
|
updater: UpdaterFn,
|
|
actionFilter: ActionFilterFn,
|
|
) => { label: string; action: () => void }[];
|
|
renderAction: (
|
|
name: string,
|
|
elements: readonly ExcalidrawElement[],
|
|
appState: AppState,
|
|
updater: UpdaterFn,
|
|
) => React.ReactElement | null;
|
|
}
|