fix some linting/prettier issues
This commit is contained in:
parent
89218ba596
commit
3700cf2d10
@ -3759,19 +3759,20 @@ 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 =
|
||||||
selectedElements[0],
|
LinearElementEditor.getPointIndexUnderCursor(
|
||||||
this.state.zoom,
|
selectedElements[0],
|
||||||
sceneX,
|
this.state.zoom,
|
||||||
sceneY,
|
sceneX,
|
||||||
);
|
sceneY,
|
||||||
|
);
|
||||||
if (pointUnderCursorIndex >= 0) {
|
if (pointUnderCursorIndex >= 0) {
|
||||||
LinearElementEditor.toggleSegmentSplitAtIndex(
|
LinearElementEditor.toggleSegmentSplitAtIndex(
|
||||||
selectedElements[0],
|
selectedElements[0],
|
||||||
pointUnderCursorIndex,
|
pointUnderCursorIndex,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
event[KEYS.CTRL_OR_CMD] &&
|
event[KEYS.CTRL_OR_CMD] &&
|
||||||
|
@ -285,7 +285,9 @@ const restoreElement = (
|
|||||||
points,
|
points,
|
||||||
x,
|
x,
|
||||||
y,
|
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(
|
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);
|
||||||
|
@ -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
|
||||||
|
@ -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)];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user