This commit is contained in:
Panayiotis Lipiridis 2020-12-28 01:26:38 +02:00
parent 2712a06ab8
commit 428752542d
4 changed files with 10 additions and 10 deletions

View File

@ -14,11 +14,11 @@ export const ButtonIconCycle = <T extends any>({
}) => {
const current = options.find((op) => op.value === value);
function cycle() {
const cycle = () => {
const index = options.indexOf(current!);
const next = (index + 1) % options.length;
onChange(options[next].value);
}
};
return (
<label key={group} className={clsx({ active: current!.value !== null })}>

View File

@ -176,7 +176,7 @@ const initializeScene = async (opts: {
return null;
};
function ExcalidrawWrapper(props: { collab: CollabAPI }) {
const ExcalidrawWrapper = (props: { collab: CollabAPI }) => {
// dimensions
// ---------------------------------------------------------------------------
@ -319,7 +319,7 @@ function ExcalidrawWrapper(props: { collab: CollabAPI }) {
)}
</>
);
}
};
export default function ExcalidrawApp() {
return (

View File

@ -349,12 +349,12 @@ const generateElementShape = (
if (element.type === "arrow") {
const { startArrowhead = null, endArrowhead = "arrow" } = element;
function getArrowheadShapes(
const getArrowheadShapes = (
element: ExcalidrawLinearElement,
shape: Drawable[],
position: "start" | "end",
arrowhead: Arrowhead,
) {
) => {
const arrowheadPoints = getArrowheadPoints(
element,
shape,
@ -392,7 +392,7 @@ const generateElementShape = (
generator.line(x3, y3, x2, y2, options),
generator.line(x4, y4, x2, y2, options),
];
}
};
if (startArrowhead !== null) {
const shapes = getArrowheadShapes(

View File

@ -122,12 +122,12 @@ describe("resize rectangle ellipses and diamond elements", () => {
);
});
function resize(
const resize = (
element: ExcalidrawElement,
handleDir: TransformHandleDirection,
mouseMove: [number, number],
keyboardModifiers: KeyboardModifiers = {},
) {
) => {
mouse.select(element);
const handle = getTransformHandles(element, h.state.zoom, "mouse")[
handleDir
@ -140,4 +140,4 @@ function resize(
mouse.move(mouseMove[0], mouseMove[1]);
mouse.up();
});
}
};