mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-24 01:40:41 +02:00
fix: False bind timeout indicator
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
@@ -1099,6 +1099,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
isOverlapping = !!(
|
isOverlapping = !!(
|
||||||
startBounds &&
|
startBounds &&
|
||||||
endBounds &&
|
endBounds &&
|
||||||
|
startElement.id !== endElement.id &&
|
||||||
doBoundsIntersect(startBounds, endBounds)
|
doBoundsIntersect(startBounds, endBounds)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -8517,48 +8518,55 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
this.state,
|
this.state,
|
||||||
{ newArrow: true },
|
{ newArrow: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
this.handleDelayedBindModeChange(element, boundElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState((prevState) => {
|
// NOTE: We need the flushSync here for the
|
||||||
let linearElementEditor = null;
|
// delayed bind mode change to see the right state
|
||||||
let nextSelectedElementIds = prevState.selectedElementIds;
|
// (specifically the `newElement`)
|
||||||
if (isLinearElement(element)) {
|
flushSync(() => {
|
||||||
linearElementEditor = new LinearElementEditor(
|
this.setState((prevState) => {
|
||||||
element,
|
let linearElementEditor = null;
|
||||||
this.scene.getNonDeletedElementsMap(),
|
let nextSelectedElementIds = prevState.selectedElementIds;
|
||||||
);
|
if (isLinearElement(element)) {
|
||||||
|
linearElementEditor = new LinearElementEditor(
|
||||||
|
element,
|
||||||
|
this.scene.getNonDeletedElementsMap(),
|
||||||
|
);
|
||||||
|
|
||||||
const endIdx = element.points.length - 1;
|
const endIdx = element.points.length - 1;
|
||||||
linearElementEditor = {
|
linearElementEditor = {
|
||||||
...linearElementEditor,
|
...linearElementEditor,
|
||||||
selectedPointsIndices: [endIdx],
|
selectedPointsIndices: [endIdx],
|
||||||
initialState: {
|
initialState: {
|
||||||
...linearElementEditor.initialState,
|
...linearElementEditor.initialState,
|
||||||
lastClickedPoint: endIdx,
|
lastClickedPoint: endIdx,
|
||||||
origin: pointFrom<GlobalPoint>(
|
origin: pointFrom<GlobalPoint>(
|
||||||
pointerDownState.origin.x,
|
pointerDownState.origin.x,
|
||||||
pointerDownState.origin.y,
|
pointerDownState.origin.y,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
nextSelectedElementIds = !this.state.activeTool.locked
|
||||||
|
? makeNextSelectedElementIds({ [element.id]: true }, prevState)
|
||||||
|
: prevState.selectedElementIds;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...prevState,
|
||||||
|
bindMode: "orbit",
|
||||||
|
newElement: element,
|
||||||
|
startBoundElement: boundElement,
|
||||||
|
suggestedBinding: boundElement || null,
|
||||||
|
selectedElementIds: nextSelectedElementIds,
|
||||||
|
selectedLinearElement: linearElementEditor,
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
|
||||||
nextSelectedElementIds = !this.state.activeTool.locked
|
|
||||||
? makeNextSelectedElementIds({ [element.id]: true }, prevState)
|
|
||||||
: prevState.selectedElementIds;
|
|
||||||
|
|
||||||
return {
|
|
||||||
...prevState,
|
|
||||||
bindMode: "orbit",
|
|
||||||
newElement: element,
|
|
||||||
startBoundElement: boundElement,
|
|
||||||
suggestedBinding: boundElement || null,
|
|
||||||
selectedElementIds: nextSelectedElementIds,
|
|
||||||
selectedLinearElement: linearElementEditor,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isBindingElement(element)) {
|
||||||
|
this.handleDelayedBindModeChange(element, boundElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user