mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-12-05 20:14:36 +01:00
fix: Finalize multipoint arrow on binding area click
This commit is contained in:
@@ -6369,6 +6369,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
||||||
this.scene.getNonDeletedElements(),
|
this.scene.getNonDeletedElements(),
|
||||||
this.scene.getNonDeletedElementsMap(),
|
this.scene.getNonDeletedElementsMap(),
|
||||||
|
(el) => maxBindingDistance_simple(this.state.zoom),
|
||||||
);
|
);
|
||||||
if (hoveredElement) {
|
if (hoveredElement) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -6392,9 +6393,18 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
setCursorForShape(this.interactiveCanvas, this.state);
|
setCursorForShape(this.interactiveCanvas, this.state);
|
||||||
|
|
||||||
if (lastPoint === lastCommittedPoint) {
|
if (lastPoint === lastCommittedPoint) {
|
||||||
// if we haven't yet created a temp point and we're beyond commit-zone
|
const hoveredElement = getHoveredElementForBinding(
|
||||||
// threshold, add a point
|
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
||||||
|
this.scene.getNonDeletedElements(),
|
||||||
|
this.scene.getNonDeletedElementsMap(),
|
||||||
|
(el) => maxBindingDistance_simple(this.state.zoom),
|
||||||
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
// Finalize arrow if we're inside the commit zone
|
||||||
|
hoveredElement ||
|
||||||
|
// if we haven't yet created a temp point and we're beyond commit-zone
|
||||||
|
// threshold, add a point
|
||||||
pointDistance(
|
pointDistance(
|
||||||
pointFrom(scenePointerX - rx, scenePointerY - ry),
|
pointFrom(scenePointerX - rx, scenePointerY - ry),
|
||||||
lastPoint,
|
lastPoint,
|
||||||
@@ -6414,19 +6424,17 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
this.state.selectedLinearElement?.initialState,
|
this.state.selectedLinearElement?.initialState,
|
||||||
"initialState must be set",
|
"initialState must be set",
|
||||||
);
|
);
|
||||||
if (this.state.selectedLinearElement.initialState) {
|
this.setState({
|
||||||
this.setState({
|
selectedLinearElement: {
|
||||||
selectedLinearElement: {
|
...this.state.selectedLinearElement,
|
||||||
...this.state.selectedLinearElement,
|
lastCommittedPoint: points[points.length - 1],
|
||||||
lastCommittedPoint: points[points.length - 1],
|
selectedPointsIndices: [multiElement.points.length - 1],
|
||||||
selectedPointsIndices: [multiElement.points.length - 1],
|
initialState: {
|
||||||
initialState: {
|
...this.state.selectedLinearElement.initialState,
|
||||||
...this.state.selectedLinearElement.initialState,
|
lastClickedPoint: multiElement.points.length - 1,
|
||||||
lastClickedPoint: multiElement.points.length - 1,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
},
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
|
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
|
||||||
// in this branch, we're inside the commit zone, and no uncommitted
|
// in this branch, we're inside the commit zone, and no uncommitted
|
||||||
|
|||||||
Reference in New Issue
Block a user