Refactor ResizeArrowFnType to resolve Codesandbox parsing error (#1338)

This commit is contained in:
Sanghyeon Lee 2020-04-10 01:10:35 +09:00 committed by GitHub
parent 8efe0b7d05
commit 9761d7ea50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 13 deletions

View File

@ -21,7 +21,6 @@ import {
getDrawingVersion, getDrawingVersion,
getSyncableElements, getSyncableElements,
newLinearElement, newLinearElement,
ResizeArrowFnType,
resizeElements, resizeElements,
getElementWithResizeHandler, getElementWithResizeHandler,
canResizeMutlipleElements, canResizeMutlipleElements,
@ -52,7 +51,11 @@ import {
import { renderScene } from "../renderer"; import { renderScene } from "../renderer";
import { AppState, GestureEvent, Gesture } from "../types"; import { AppState, GestureEvent, Gesture } from "../types";
import { ExcalidrawElement, ExcalidrawTextElement } from "../element/types"; import {
ExcalidrawElement,
ExcalidrawTextElement,
ResizeArrowFnType,
} from "../element/types";
import { distance2d, isPathALoop } from "../math"; import { distance2d, isPathALoop } from "../math";

View File

@ -29,7 +29,6 @@ export {
getElementWithResizeHandler, getElementWithResizeHandler,
getResizeHandlerFromCoords, getResizeHandlerFromCoords,
} from "./resizeTest"; } from "./resizeTest";
export type { ResizeArrowFnType } from "./resizeElements";
export { resizeElements, canResizeMutlipleElements } from "./resizeElements"; export { resizeElements, canResizeMutlipleElements } from "./resizeElements";
export { isTextElement, isExcalidrawElement } from "./typeChecks"; export { isTextElement, isExcalidrawElement } from "./typeChecks";
export { textWysiwyg } from "./textWysiwyg"; export { textWysiwyg } from "./textWysiwyg";

View File

@ -2,11 +2,13 @@ import { AppState } from "../types";
import { SHIFT_LOCKING_ANGLE } from "../constants"; import { SHIFT_LOCKING_ANGLE } from "../constants";
import { getSelectedElements, globalSceneState } from "../scene"; import { getSelectedElements, globalSceneState } from "../scene";
import { rescalePoints } from "../points"; import { rescalePoints } from "../points";
import { rotate, resizeXYWidthHightWithRotation } from "../math"; import { rotate, resizeXYWidthHightWithRotation } from "../math";
import { import {
ExcalidrawLinearElement, ExcalidrawLinearElement,
NonDeletedExcalidrawElement, NonDeletedExcalidrawElement,
NonDeleted, NonDeleted,
ResizeArrowFnType,
} from "./types"; } from "./types";
import { getElementAbsoluteCoords, getCommonBounds } from "./bounds"; import { getElementAbsoluteCoords, getCommonBounds } from "./bounds";
import { isLinearElement } from "./typeChecks"; import { isLinearElement } from "./typeChecks";
@ -20,16 +22,6 @@ import {
type ResizeTestType = ReturnType<typeof resizeTest>; type ResizeTestType = ReturnType<typeof resizeTest>;
export type ResizeArrowFnType = (
element: NonDeleted<ExcalidrawLinearElement>,
pointIndex: number,
deltaX: number,
deltaY: number,
pointerX: number,
pointerY: number,
sidesWithSameLength: boolean,
) => void;
const arrowResizeOrigin: ResizeArrowFnType = ( const arrowResizeOrigin: ResizeArrowFnType = (
element, element,
pointIndex, pointIndex,

View File

@ -58,3 +58,13 @@ export type ExcalidrawLinearElement = _ExcalidrawElementBase &
export type PointerType = "mouse" | "pen" | "touch"; export type PointerType = "mouse" | "pen" | "touch";
export type TextAlign = "left" | "center" | "right"; export type TextAlign = "left" | "center" | "right";
export type ResizeArrowFnType = (
element: NonDeleted<ExcalidrawLinearElement>,
pointIndex: number,
deltaX: number,
deltaY: number,
pointerX: number,
pointerY: number,
perfect: boolean,
) => void;