fix some linting/prettier issues
This commit is contained in:
parent
89218ba596
commit
3700cf2d10
@ -3759,12 +3759,13 @@ 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],
|
||||
|
@ -285,7 +285,9 @@ const restoreElement = (
|
||||
points,
|
||||
x,
|
||||
y,
|
||||
segmentSplitIndices: element.segmentSplitIndices ? [...element.segmentSplitIndices] : [],
|
||||
segmentSplitIndices: element.segmentSplitIndices
|
||||
? [...element.segmentSplitIndices]
|
||||
: [],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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)];
|
||||
|
Loading…
x
Reference in New Issue
Block a user