diff --git a/src/components/App.tsx b/src/components/App.tsx index fb33e2843..8ec5e040a 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -3759,19 +3759,20 @@ class App extends React.Component { 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] && diff --git a/src/data/restore.ts b/src/data/restore.ts index 14c6f0ed5..2959983c9 100644 --- a/src/data/restore.ts +++ b/src/data/restore.ts @@ -285,7 +285,9 @@ const restoreElement = ( points, x, y, - segmentSplitIndices: element.segmentSplitIndices ? [...element.segmentSplitIndices] : [], + segmentSplitIndices: element.segmentSplitIndices + ? [...element.segmentSplitIndices] + : [], }); } diff --git a/src/element/linearElementEditor.ts b/src/element/linearElementEditor.ts index 67ffc737d..95e8eefb3 100644 --- a/src/element/linearElementEditor.ts +++ b/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); diff --git a/src/renderer/renderScene.ts b/src/renderer/renderScene.ts index 2cdcab0b3..a9d174b67 100644 --- a/src/renderer/renderScene.ts +++ b/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 diff --git a/src/scene/Shape.ts b/src/scene/Shape.ts index cd61e5d68..2141aa718 100644 --- a/src/scene/Shape.ts +++ b/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)];