order
This commit is contained in:
parent
9cfab40343
commit
28a1b9a787
@ -1,167 +1,180 @@
|
|||||||
import { Point, simplify } from "points-on-curve";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { RoughCanvas } from "roughjs/bin/canvas";
|
|
||||||
import rough from "roughjs/bin/rough";
|
import rough from "roughjs/bin/rough";
|
||||||
import "../actions";
|
import { RoughCanvas } from "roughjs/bin/canvas";
|
||||||
import { actionDeleteSelected, actionFinalize } from "../actions";
|
import { simplify, Point } from "points-on-curve";
|
||||||
import { createRedoAction, createUndoAction } from "../actions/actionHistory";
|
|
||||||
import { ActionManager } from "../actions/manager";
|
|
||||||
import { actions } from "../actions/register";
|
|
||||||
import { ActionResult } from "../actions/types";
|
|
||||||
import {
|
import {
|
||||||
EVENT_DIALOG,
|
newElement,
|
||||||
EVENT_LIBRARY,
|
newTextElement,
|
||||||
EVENT_SHAPE,
|
duplicateElement,
|
||||||
trackEvent,
|
isInvisiblySmallElement,
|
||||||
} from "../analytics";
|
isTextElement,
|
||||||
|
textWysiwyg,
|
||||||
|
getCommonBounds,
|
||||||
|
getCursorForResizingElement,
|
||||||
|
getPerfectElementSize,
|
||||||
|
getNormalizedDimensions,
|
||||||
|
newLinearElement,
|
||||||
|
transformElements,
|
||||||
|
getElementWithTransformHandleType,
|
||||||
|
getResizeOffsetXY,
|
||||||
|
getResizeArrowDirection,
|
||||||
|
getTransformHandleTypeFromCoords,
|
||||||
|
isNonDeletedElement,
|
||||||
|
updateTextElement,
|
||||||
|
dragSelectedElements,
|
||||||
|
getDragOffsetXY,
|
||||||
|
dragNewElement,
|
||||||
|
hitTest,
|
||||||
|
isHittingElementBoundingBoxWithoutHittingElement,
|
||||||
|
getNonDeletedElements,
|
||||||
|
} from "../element";
|
||||||
|
import {
|
||||||
|
getElementsWithinSelection,
|
||||||
|
isOverScrollBars,
|
||||||
|
getElementsAtPosition,
|
||||||
|
getElementContainingPosition,
|
||||||
|
getNormalizedZoom,
|
||||||
|
getSelectedElements,
|
||||||
|
isSomeElementSelected,
|
||||||
|
calculateScrollCenter,
|
||||||
|
} from "../scene";
|
||||||
|
import { loadFromBlob, exportCanvas } from "../data";
|
||||||
|
|
||||||
|
import { renderScene } from "../renderer";
|
||||||
|
import {
|
||||||
|
AppState,
|
||||||
|
GestureEvent,
|
||||||
|
Gesture,
|
||||||
|
ExcalidrawProps,
|
||||||
|
SceneData,
|
||||||
|
} from "../types";
|
||||||
|
import {
|
||||||
|
ExcalidrawElement,
|
||||||
|
ExcalidrawTextElement,
|
||||||
|
NonDeleted,
|
||||||
|
ExcalidrawGenericElement,
|
||||||
|
ExcalidrawLinearElement,
|
||||||
|
ExcalidrawBindableElement,
|
||||||
|
} from "../element/types";
|
||||||
|
|
||||||
|
import { distance2d, isPathALoop, getGridPoint } from "../math";
|
||||||
|
|
||||||
|
import {
|
||||||
|
isWritableElement,
|
||||||
|
isInputLike,
|
||||||
|
isToolIcon,
|
||||||
|
debounce,
|
||||||
|
distance,
|
||||||
|
resetCursor,
|
||||||
|
viewportCoordsToSceneCoords,
|
||||||
|
sceneCoordsToViewportCoords,
|
||||||
|
setCursorForShape,
|
||||||
|
tupleToCoors,
|
||||||
|
ResolvablePromise,
|
||||||
|
resolvablePromise,
|
||||||
|
withBatchedUpdates,
|
||||||
|
} from "../utils";
|
||||||
|
import {
|
||||||
|
KEYS,
|
||||||
|
isArrowKey,
|
||||||
|
getResizeCenterPointKey,
|
||||||
|
getResizeWithSidesSameLengthKey,
|
||||||
|
getRotateWithDiscreteAngleKey,
|
||||||
|
CODES,
|
||||||
|
} from "../keys";
|
||||||
|
|
||||||
|
import { findShapeByKey } from "../shapes";
|
||||||
|
import { createHistory, SceneHistory } from "../history";
|
||||||
|
|
||||||
|
import ContextMenu from "./ContextMenu";
|
||||||
|
|
||||||
|
import { ActionManager } from "../actions/manager";
|
||||||
|
import "../actions";
|
||||||
|
import { actions } from "../actions/register";
|
||||||
|
|
||||||
|
import { ActionResult } from "../actions/types";
|
||||||
import { getDefaultAppState } from "../appState";
|
import { getDefaultAppState } from "../appState";
|
||||||
import { renderSpreadsheet } from "../charts";
|
import { t, getLanguage } from "../i18n";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
parseClipboard,
|
parseClipboard,
|
||||||
probablySupportsClipboardBlob,
|
probablySupportsClipboardBlob,
|
||||||
probablySupportsClipboardWriteText,
|
probablySupportsClipboardWriteText,
|
||||||
} from "../clipboard";
|
} from "../clipboard";
|
||||||
|
import { normalizeScroll } from "../scene";
|
||||||
|
import { getCenter, getDistance } from "../gesture";
|
||||||
|
import { createUndoAction, createRedoAction } from "../actions/actionHistory";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
APP_NAME,
|
|
||||||
CANVAS_ONLY_ACTIONS,
|
|
||||||
CURSOR_TYPE,
|
CURSOR_TYPE,
|
||||||
DEFAULT_VERTICAL_ALIGN,
|
|
||||||
DRAGGING_THRESHOLD,
|
|
||||||
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
||||||
ELEMENT_TRANSLATE_AMOUNT,
|
ELEMENT_TRANSLATE_AMOUNT,
|
||||||
ENV,
|
|
||||||
EVENT,
|
|
||||||
LINE_CONFIRM_THRESHOLD,
|
|
||||||
MIME_TYPES,
|
|
||||||
POINTER_BUTTON,
|
POINTER_BUTTON,
|
||||||
TAP_TWICE_TIMEOUT,
|
DRAGGING_THRESHOLD,
|
||||||
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
||||||
|
LINE_CONFIRM_THRESHOLD,
|
||||||
|
EVENT,
|
||||||
|
ENV,
|
||||||
|
CANVAS_ONLY_ACTIONS,
|
||||||
|
DEFAULT_VERTICAL_ALIGN,
|
||||||
|
MIME_TYPES,
|
||||||
|
TAP_TWICE_TIMEOUT,
|
||||||
TOUCH_CTX_MENU_TIMEOUT,
|
TOUCH_CTX_MENU_TIMEOUT,
|
||||||
|
APP_NAME,
|
||||||
} from "../constants";
|
} from "../constants";
|
||||||
import { exportCanvas, loadFromBlob } from "../data";
|
|
||||||
import { isValidLibrary } from "../data/json";
|
import LayerUI from "./LayerUI";
|
||||||
import { Library } from "../data/library";
|
import { ScrollBars, SceneState } from "../scene/types";
|
||||||
import { restore } from "../data/restore";
|
|
||||||
import {
|
|
||||||
dragNewElement,
|
|
||||||
dragSelectedElements,
|
|
||||||
duplicateElement,
|
|
||||||
getCommonBounds,
|
|
||||||
getCursorForResizingElement,
|
|
||||||
getDragOffsetXY,
|
|
||||||
getElementWithTransformHandleType,
|
|
||||||
getNonDeletedElements,
|
|
||||||
getNormalizedDimensions,
|
|
||||||
getPerfectElementSize,
|
|
||||||
getResizeArrowDirection,
|
|
||||||
getResizeOffsetXY,
|
|
||||||
getTransformHandleTypeFromCoords,
|
|
||||||
hitTest,
|
|
||||||
isHittingElementBoundingBoxWithoutHittingElement,
|
|
||||||
isInvisiblySmallElement,
|
|
||||||
isNonDeletedElement,
|
|
||||||
isTextElement,
|
|
||||||
newElement,
|
|
||||||
newLinearElement,
|
|
||||||
newTextElement,
|
|
||||||
textWysiwyg,
|
|
||||||
transformElements,
|
|
||||||
updateTextElement,
|
|
||||||
} from "../element";
|
|
||||||
import {
|
|
||||||
bindOrUnbindSelectedElements,
|
|
||||||
fixBindingsAfterDeletion,
|
|
||||||
fixBindingsAfterDuplication,
|
|
||||||
getEligibleElementsForBinding,
|
|
||||||
getHoveredElementForBinding,
|
|
||||||
isBindingEnabled,
|
|
||||||
isLinearElementSimpleAndAlreadyBound,
|
|
||||||
maybeBindLinearElement,
|
|
||||||
shouldEnableBindingForPointerEvent,
|
|
||||||
unbindLinearElements,
|
|
||||||
updateBoundElements,
|
|
||||||
} from "../element/binding";
|
|
||||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
||||||
import { mutateElement } from "../element/mutateElement";
|
import { mutateElement } from "../element/mutateElement";
|
||||||
import { deepCopyElement } from "../element/newElement";
|
|
||||||
import { MaybeTransformHandleType } from "../element/transformHandles";
|
|
||||||
import {
|
|
||||||
isBindingElement,
|
|
||||||
isBindingElementType,
|
|
||||||
isLinearElement,
|
|
||||||
isLinearElementType,
|
|
||||||
} from "../element/typeChecks";
|
|
||||||
import {
|
|
||||||
ExcalidrawBindableElement,
|
|
||||||
ExcalidrawElement,
|
|
||||||
ExcalidrawGenericElement,
|
|
||||||
ExcalidrawLinearElement,
|
|
||||||
ExcalidrawTextElement,
|
|
||||||
NonDeleted,
|
|
||||||
} from "../element/types";
|
|
||||||
import { getCenter, getDistance } from "../gesture";
|
|
||||||
import {
|
|
||||||
editGroupForSelectedElement,
|
|
||||||
getElementsInGroup,
|
|
||||||
getSelectedGroupIdForElement,
|
|
||||||
getSelectedGroupIds,
|
|
||||||
isElementInGroup,
|
|
||||||
isSelectedViaGroup,
|
|
||||||
selectGroupsForSelectedElements,
|
|
||||||
} from "../groups";
|
|
||||||
import { createHistory, SceneHistory } from "../history";
|
|
||||||
import { getLanguage, t } from "../i18n";
|
|
||||||
import {
|
|
||||||
CODES,
|
|
||||||
getResizeCenterPointKey,
|
|
||||||
getResizeWithSidesSameLengthKey,
|
|
||||||
getRotateWithDiscreteAngleKey,
|
|
||||||
isArrowKey,
|
|
||||||
KEYS,
|
|
||||||
} from "../keys";
|
|
||||||
import { distance2d, getGridPoint, isPathALoop } from "../math";
|
|
||||||
import { renderScene } from "../renderer";
|
|
||||||
import { invalidateShapeForElement } from "../renderer/renderElement";
|
import { invalidateShapeForElement } from "../renderer/renderElement";
|
||||||
import {
|
import {
|
||||||
calculateScrollCenter,
|
isLinearElement,
|
||||||
getElementContainingPosition,
|
isLinearElementType,
|
||||||
getElementsAtPosition,
|
isBindingElement,
|
||||||
getElementsWithinSelection,
|
isBindingElementType,
|
||||||
getNormalizedZoom,
|
} from "../element/typeChecks";
|
||||||
getSelectedElements,
|
import { actionFinalize, actionDeleteSelected } from "../actions";
|
||||||
isOverScrollBars,
|
|
||||||
isSomeElementSelected,
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||||
normalizeScroll,
|
import {
|
||||||
} from "../scene";
|
getSelectedGroupIds,
|
||||||
|
isSelectedViaGroup,
|
||||||
|
selectGroupsForSelectedElements,
|
||||||
|
isElementInGroup,
|
||||||
|
getSelectedGroupIdForElement,
|
||||||
|
getElementsInGroup,
|
||||||
|
editGroupForSelectedElement,
|
||||||
|
} from "../groups";
|
||||||
|
import { Library } from "../data/library";
|
||||||
import Scene from "../scene/Scene";
|
import Scene from "../scene/Scene";
|
||||||
import { SceneState, ScrollBars } from "../scene/types";
|
import {
|
||||||
|
getHoveredElementForBinding,
|
||||||
|
maybeBindLinearElement,
|
||||||
|
getEligibleElementsForBinding,
|
||||||
|
bindOrUnbindSelectedElements,
|
||||||
|
unbindLinearElements,
|
||||||
|
fixBindingsAfterDuplication,
|
||||||
|
fixBindingsAfterDeletion,
|
||||||
|
isLinearElementSimpleAndAlreadyBound,
|
||||||
|
isBindingEnabled,
|
||||||
|
updateBoundElements,
|
||||||
|
shouldEnableBindingForPointerEvent,
|
||||||
|
} from "../element/binding";
|
||||||
|
import { MaybeTransformHandleType } from "../element/transformHandles";
|
||||||
|
import { deepCopyElement } from "../element/newElement";
|
||||||
|
import { renderSpreadsheet } from "../charts";
|
||||||
|
import { isValidLibrary } from "../data/json";
|
||||||
import { getNewZoom } from "../scene/zoom";
|
import { getNewZoom } from "../scene/zoom";
|
||||||
import { findShapeByKey } from "../shapes";
|
import { restore } from "../data/restore";
|
||||||
import {
|
import {
|
||||||
AppState,
|
EVENT_DIALOG,
|
||||||
ExcalidrawProps,
|
EVENT_LIBRARY,
|
||||||
Gesture,
|
EVENT_SHAPE,
|
||||||
GestureEvent,
|
trackEvent,
|
||||||
SceneData,
|
} from "../analytics";
|
||||||
} from "../types";
|
|
||||||
import {
|
|
||||||
debounce,
|
|
||||||
distance,
|
|
||||||
isInputLike,
|
|
||||||
isToolIcon,
|
|
||||||
isWritableElement,
|
|
||||||
resetCursor,
|
|
||||||
ResolvablePromise,
|
|
||||||
resolvablePromise,
|
|
||||||
sceneCoordsToViewportCoords,
|
|
||||||
setCursorForShape,
|
|
||||||
tupleToCoors,
|
|
||||||
viewportCoordsToSceneCoords,
|
|
||||||
withBatchedUpdates,
|
|
||||||
} from "../utils";
|
|
||||||
import ContextMenu from "./ContextMenu";
|
|
||||||
import LayerUI from "./LayerUI";
|
|
||||||
import { Stats } from "./Stats";
|
import { Stats } from "./Stats";
|
||||||
|
|
||||||
const { history } = createHistory();
|
const { history } = createHistory();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user