chore: Laxing on invariants

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs
2025-09-09 11:20:43 +02:00
parent 35c986cbef
commit fce13ccefd

View File

@@ -985,10 +985,13 @@ class App extends React.Component<AppProps, AppState> {
);
if (!this.state.multiElement) {
invariant(
this.state.selectedLinearElement?.selectedPointsIndices?.length,
"There has to be at least one selected point to trigger bind mode change at arrow point drag",
);
if (
!this.state.selectedLinearElement ||
!this.state.selectedLinearElement.selectedPointsIndices ||
!this.state.selectedLinearElement.selectedPointsIndices.length
) {
return;
}
const startDragged =
this.state.selectedLinearElement.selectedPointsIndices.includes(0);
@@ -6298,16 +6301,11 @@ class App extends React.Component<AppProps, AppState> {
}
}
if (this.state.multiElement) {
if (this.state.multiElement && this.state.selectedLinearElement) {
const { multiElement, selectedLinearElement } = this.state;
const { x: rx, y: ry, points } = multiElement;
const lastPoint = points[points.length - 1];
invariant(
selectedLinearElement,
"There must be a selected linear element instace",
);
const { lastCommittedPoint } = selectedLinearElement;
setCursorForShape(this.interactiveCanvas, this.state);