fix: do not finalize multi-point lines if binding not enabled (#10410)
* fix: do not finalize multi-point lines if binding not enabled * refactor
This commit is contained in:
@@ -6396,12 +6396,15 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
setCursorForShape(this.interactiveCanvas, this.state);
|
setCursorForShape(this.interactiveCanvas, this.state);
|
||||||
|
|
||||||
if (lastPoint === lastCommittedPoint) {
|
if (lastPoint === lastCommittedPoint) {
|
||||||
const hoveredElement = getHoveredElementForBinding(
|
const hoveredElement =
|
||||||
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
isArrowElement(this.state.newElement) &&
|
||||||
this.scene.getNonDeletedElements(),
|
isBindingEnabled(this.state) &&
|
||||||
this.scene.getNonDeletedElementsMap(),
|
getHoveredElementForBinding(
|
||||||
(el) => maxBindingDistance_simple(this.state.zoom),
|
pointFrom<GlobalPoint>(scenePointerX, scenePointerY),
|
||||||
);
|
this.scene.getNonDeletedElements(),
|
||||||
|
this.scene.getNonDeletedElementsMap(),
|
||||||
|
(el) => maxBindingDistance_simple(this.state.zoom),
|
||||||
|
);
|
||||||
if (hoveredElement) {
|
if (hoveredElement) {
|
||||||
this.actionManager.executeAction(actionFinalize, "ui", {
|
this.actionManager.executeAction(actionFinalize, "ui", {
|
||||||
event: event.nativeEvent,
|
event: event.nativeEvent,
|
||||||
@@ -8464,16 +8467,18 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
const { x: rx, y: ry } = multiElement;
|
const { x: rx, y: ry } = multiElement;
|
||||||
const { lastCommittedPoint } = selectedLinearElement;
|
const { lastCommittedPoint } = selectedLinearElement;
|
||||||
|
|
||||||
const hoveredElementForBinding = getHoveredElementForBinding(
|
const hoveredElementForBinding =
|
||||||
pointFrom<GlobalPoint>(
|
isBindingEnabled(this.state) &&
|
||||||
this.lastPointerMoveCoords?.x ??
|
getHoveredElementForBinding(
|
||||||
rx + multiElement.points[multiElement.points.length - 1][0],
|
pointFrom<GlobalPoint>(
|
||||||
this.lastPointerMoveCoords?.y ??
|
this.lastPointerMoveCoords?.x ??
|
||||||
ry + multiElement.points[multiElement.points.length - 1][1],
|
rx + multiElement.points[multiElement.points.length - 1][0],
|
||||||
),
|
this.lastPointerMoveCoords?.y ??
|
||||||
this.scene.getNonDeletedElements(),
|
ry + multiElement.points[multiElement.points.length - 1][1],
|
||||||
this.scene.getNonDeletedElementsMap(),
|
),
|
||||||
);
|
this.scene.getNonDeletedElements(),
|
||||||
|
this.scene.getNonDeletedElementsMap(),
|
||||||
|
);
|
||||||
|
|
||||||
// clicking inside commit zone → finalize arrow
|
// clicking inside commit zone → finalize arrow
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user