Browse Source

fix some linting/prettier issues

Preet 1 year ago
parent
commit
3700cf2d10

+ 8 - 7
src/components/App.tsx

@@ -3759,19 +3759,20 @@ class App extends React.Component<AppProps, AppState> {
 
     if (selectedElements.length === 1 && isLinearElement(selectedElements[0])) {
       if (selectedElements[0].roundness) {
-        const pointUnderCursorIndex = LinearElementEditor.getPointIndexUnderCursor(
-          selectedElements[0],
-          this.state.zoom,
-          sceneX,
-          sceneY,
-        );
+        const pointUnderCursorIndex =
+          LinearElementEditor.getPointIndexUnderCursor(
+            selectedElements[0],
+            this.state.zoom,
+            sceneX,
+            sceneY,
+          );
         if (pointUnderCursorIndex >= 0) {
           LinearElementEditor.toggleSegmentSplitAtIndex(
             selectedElements[0],
             pointUnderCursorIndex,
           );
           return;
-        } 
+        }
       }
       if (
         event[KEYS.CTRL_OR_CMD] &&

+ 3 - 1
src/data/restore.ts

@@ -285,7 +285,9 @@ const restoreElement = (
         points,
         x,
         y,
-        segmentSplitIndices: element.segmentSplitIndices ? [...element.segmentSplitIndices] : [],
+        segmentSplitIndices: element.segmentSplitIndices
+          ? [...element.segmentSplitIndices]
+          : [],
       });
     }
 

+ 11 - 3
src/element/linearElementEditor.ts

@@ -1078,7 +1078,9 @@ export class LinearElementEditor {
       }
     });
 
-    LinearElementEditor._updatePoints(element, nextPoints, offsetX, offsetY, { segmentSplitIndices: splits });
+    LinearElementEditor._updatePoints(element, nextPoints, offsetX, offsetY, {
+      segmentSplitIndices: splits,
+    });
   }
 
   static addPoints(
@@ -1217,7 +1219,9 @@ export class LinearElementEditor {
       midpoint,
       ...element.points.slice(segmentMidpoint.index!),
     ];
-    const splits = (element.segmentSplitIndices || []).map((index) => (index >= segmentMidpoint.index!) ? (index + 1) : index);
+    const splits = (element.segmentSplitIndices || []).map((index) =>
+      index >= segmentMidpoint.index! ? index + 1 : index,
+    );
 
     mutateElement(element, {
       points,
@@ -1241,7 +1245,11 @@ export class LinearElementEditor {
     nextPoints: readonly Point[],
     offsetX: number,
     offsetY: number,
-    otherUpdates?: { startBinding?: PointBinding; endBinding?: PointBinding, segmentSplitIndices?: number[] },
+    otherUpdates?: {
+      startBinding?: PointBinding;
+      endBinding?: PointBinding;
+      segmentSplitIndices?: number[];
+    },
   ) {
     const nextCoords = getElementPointsCoords(element, nextPoints);
     const prevCoords = getElementPointsCoords(element, element.points);

+ 13 - 2
src/renderer/renderScene.ts

@@ -279,9 +279,20 @@ const renderLinearPointHandles = (
     const isSelected =
       !!appState.editingLinearElement?.selectedPointsIndices?.includes(idx);
 
-    const segmented = element.roundness ? (element.segmentSplitIndices ? element.segmentSplitIndices.includes(idx) : false) : false;
+    const segmented = element.roundness
+      ? element.segmentSplitIndices
+        ? element.segmentSplitIndices.includes(idx)
+        : false
+      : false;
 
-    renderSingleLinearPoint(context, appState, point, radius, isSelected, segmented);
+    renderSingleLinearPoint(
+      context,
+      appState,
+      point,
+      radius,
+      isSelected,
+      segmented,
+    );
   });
 
   //Rendering segment mid points

+ 4 - 2
src/scene/Shape.ts

@@ -229,7 +229,9 @@ export const _generateElementShape = (
 
       // points array can be empty in the beginning, so it is important to add
       // initial position to it
-      const points = element.points.length ? element.points : [[0, 0]] as Point[];
+      const points = element.points.length
+        ? element.points
+        : ([[0, 0]] as Point[]);
 
       // curve is always the first element
       // this simplifies finding the curve for an element
@@ -250,7 +252,7 @@ export const _generateElementShape = (
           }
           currentIndex = index;
         }
-        if (currentIndex < (points.length - 1)) {
+        if (currentIndex < points.length - 1) {
           pointList.push(points.slice(currentIndex));
         }
         shape = [generator.curve(pointList as [number, number][][], options)];