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); const current = options.find((op) => op.value === value);
function cycle() { const cycle = () => {
const index = options.indexOf(current!); const index = options.indexOf(current!);
const next = (index + 1) % options.length; const next = (index + 1) % options.length;
onChange(options[next].value); onChange(options[next].value);
} };
return ( return (
<label key={group} className={clsx({ active: current!.value !== null })}> <label key={group} className={clsx({ active: current!.value !== null })}>

View File

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

View File

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

View File

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