Panayiotis Lipiridis 4 سال پیش
والد
کامیت
428752542d
4فایلهای تغییر یافته به همراه10 افزوده شده و 10 حذف شده
  1. 2 2
      src/components/ButtonIconCycle.tsx
  2. 2 2
      src/excalidraw-app/index.tsx
  3. 3 3
      src/renderer/renderElement.ts
  4. 3 3
      src/tests/resize.test.tsx

+ 2 - 2
src/components/ButtonIconCycle.tsx

@@ -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 })}>

+ 2 - 2
src/excalidraw-app/index.tsx

@@ -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 (

+ 3 - 3
src/renderer/renderElement.ts

@@ -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(

+ 3 - 3
src/tests/resize.test.tsx

@@ -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();
   });
-}
+};