fix some linting/prettier issues

This commit is contained in:
Preet 2023-10-23 10:50:52 -07:00
parent 89218ba596
commit 3700cf2d10
5 changed files with 39 additions and 15 deletions

View File

@ -3759,7 +3759,8 @@ class App extends React.Component<AppProps, AppState> {
if (selectedElements.length === 1 && isLinearElement(selectedElements[0])) { if (selectedElements.length === 1 && isLinearElement(selectedElements[0])) {
if (selectedElements[0].roundness) { if (selectedElements[0].roundness) {
const pointUnderCursorIndex = LinearElementEditor.getPointIndexUnderCursor( const pointUnderCursorIndex =
LinearElementEditor.getPointIndexUnderCursor(
selectedElements[0], selectedElements[0],
this.state.zoom, this.state.zoom,
sceneX, sceneX,

View File

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

View File

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

View File

@ -279,9 +279,20 @@ const renderLinearPointHandles = (
const isSelected = const isSelected =
!!appState.editingLinearElement?.selectedPointsIndices?.includes(idx); !!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 //Rendering segment mid points

View File

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