mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-17 16:59:04 -04:00
Different approach to inside binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
c229e7a42a
commit
ac5612db2a
@ -409,7 +409,8 @@ const bindingStrategyForNewSimpleArrowEndpointDragging = (
|
|||||||
otherElement.x + otherElement.width / 2,
|
otherElement.x + otherElement.width / 2,
|
||||||
otherElement.y + otherElement.height / 2,
|
otherElement.y + otherElement.height / 2,
|
||||||
);
|
);
|
||||||
const otherIsInsideBinding = arrow.startBinding?.mode === "inside";
|
const otherIsInsideBinding =
|
||||||
|
!!appState.selectedLinearElement?.pointerDownState.arrowStartIsInside;
|
||||||
|
|
||||||
// We need to "jump" the start point out with the detached
|
// We need to "jump" the start point out with the detached
|
||||||
// focus point of the center of the bound element
|
// focus point of the center of the bound element
|
||||||
|
@ -143,6 +143,7 @@ export class LinearElementEditor {
|
|||||||
added: boolean;
|
added: boolean;
|
||||||
};
|
};
|
||||||
arrowOriginalStartPoint?: GlobalPoint;
|
arrowOriginalStartPoint?: GlobalPoint;
|
||||||
|
arrowStartIsInside: boolean;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
/** whether you're dragging a point */
|
/** whether you're dragging a point */
|
||||||
@ -186,6 +187,7 @@ export class LinearElementEditor {
|
|||||||
index: null,
|
index: null,
|
||||||
added: false,
|
added: false,
|
||||||
},
|
},
|
||||||
|
arrowStartIsInside: false,
|
||||||
};
|
};
|
||||||
this.hoverPointIndex = -1;
|
this.hoverPointIndex = -1;
|
||||||
this.segmentMidPointHoveredCoords = null;
|
this.segmentMidPointHoveredCoords = null;
|
||||||
@ -582,6 +584,7 @@ export class LinearElementEditor {
|
|||||||
pointerDownState: {
|
pointerDownState: {
|
||||||
...editingLinearElement.pointerDownState,
|
...editingLinearElement.pointerDownState,
|
||||||
arrowOriginalStartPoint: undefined,
|
arrowOriginalStartPoint: undefined,
|
||||||
|
arrowStartIsInside: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -889,6 +892,9 @@ export class LinearElementEditor {
|
|||||||
index: segmentMidpointIndex,
|
index: segmentMidpointIndex,
|
||||||
added: false,
|
added: false,
|
||||||
},
|
},
|
||||||
|
arrowStartIsInside:
|
||||||
|
!!app.state.newElement &&
|
||||||
|
(app.state.bindMode === "inside" || app.state.bindMode === "skip"),
|
||||||
},
|
},
|
||||||
selectedPointsIndices: [element.points.length - 1],
|
selectedPointsIndices: [element.points.length - 1],
|
||||||
lastUncommittedPoint: null,
|
lastUncommittedPoint: null,
|
||||||
@ -948,6 +954,9 @@ export class LinearElementEditor {
|
|||||||
index: segmentMidpointIndex,
|
index: segmentMidpointIndex,
|
||||||
added: false,
|
added: false,
|
||||||
},
|
},
|
||||||
|
arrowStartIsInside:
|
||||||
|
!!app.state.newElement &&
|
||||||
|
(app.state.bindMode === "inside" || app.state.bindMode === "skip"),
|
||||||
},
|
},
|
||||||
selectedPointsIndices: nextSelectedPointsIndices,
|
selectedPointsIndices: nextSelectedPointsIndices,
|
||||||
pointerOffset: targetPoint
|
pointerOffset: targetPoint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user