|
@@ -5965,17 +5965,33 @@ class App extends React.Component<AppProps, AppState> {
|
|
if (isPathALoop(points, this.state.zoom.value)) {
|
|
if (isPathALoop(points, this.state.zoom.value)) {
|
|
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
|
|
setCursor(this.interactiveCanvas, CURSOR_TYPE.POINTER);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ const outlineGlobalPoint =
|
|
|
|
+ LinearElementEditor.getOutlineAvoidingPointOrNull(
|
|
|
|
+ multiElement,
|
|
|
|
+ {
|
|
|
|
+ x: scenePointerX,
|
|
|
|
+ y: scenePointerY,
|
|
|
|
+ },
|
|
|
|
+ multiElement.points.length - 1,
|
|
|
|
+ this,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ const nextPoint = outlineGlobalPoint
|
|
|
|
+ ? pointFrom<LocalPoint>(
|
|
|
|
+ outlineGlobalPoint[0] - rx,
|
|
|
|
+ outlineGlobalPoint[1] - ry,
|
|
|
|
+ )
|
|
|
|
+ : pointFrom<LocalPoint>(
|
|
|
|
+ lastCommittedX + dxFromLastCommitted,
|
|
|
|
+ lastCommittedY + dyFromLastCommitted,
|
|
|
|
+ );
|
|
|
|
+
|
|
// update last uncommitted point
|
|
// update last uncommitted point
|
|
mutateElement(
|
|
mutateElement(
|
|
multiElement,
|
|
multiElement,
|
|
{
|
|
{
|
|
- points: [
|
|
|
|
- ...points.slice(0, -1),
|
|
|
|
- pointFrom<LocalPoint>(
|
|
|
|
- lastCommittedX + dxFromLastCommitted,
|
|
|
|
- lastCommittedY + dyFromLastCommitted,
|
|
|
|
- ),
|
|
|
|
- ],
|
|
|
|
|
|
+ points: [...points.slice(0, -1), nextPoint],
|
|
},
|
|
},
|
|
false,
|
|
false,
|
|
{
|
|
{
|
|
@@ -7715,18 +7731,34 @@ class App extends React.Component<AppProps, AppState> {
|
|
}
|
|
}
|
|
|
|
|
|
const { x: rx, y: ry, lastCommittedPoint } = multiElement;
|
|
const { x: rx, y: ry, lastCommittedPoint } = multiElement;
|
|
|
|
+ const lastGlobalPoint = pointFrom<GlobalPoint>(
|
|
|
|
+ rx + multiElement.points[multiElement.points.length - 1][0],
|
|
|
|
+ ry + multiElement.points[multiElement.points.length - 1][1],
|
|
|
|
+ );
|
|
|
|
+ const hoveredElementForBinding = getHoveredElementForBinding(
|
|
|
|
+ {
|
|
|
|
+ x: lastGlobalPoint[0],
|
|
|
|
+ y: lastGlobalPoint[1],
|
|
|
|
+ },
|
|
|
|
+ this.scene.getNonDeletedElements(),
|
|
|
|
+ this.scene.getNonDeletedElementsMap(),
|
|
|
|
+ this.state.zoom,
|
|
|
|
+ true,
|
|
|
|
+ isElbowArrow(multiElement),
|
|
|
|
+ );
|
|
|
|
|
|
// clicking inside commit zone → finalize arrow
|
|
// clicking inside commit zone → finalize arrow
|
|
if (
|
|
if (
|
|
- multiElement.points.length > 1 &&
|
|
|
|
- lastCommittedPoint &&
|
|
|
|
- pointDistance(
|
|
|
|
- pointFrom(
|
|
|
|
- pointerDownState.origin.x - rx,
|
|
|
|
- pointerDownState.origin.y - ry,
|
|
|
|
- ),
|
|
|
|
- lastCommittedPoint,
|
|
|
|
- ) < LINE_CONFIRM_THRESHOLD
|
|
|
|
|
|
+ !!hoveredElementForBinding ||
|
|
|
|
+ (multiElement.points.length > 1 &&
|
|
|
|
+ lastCommittedPoint &&
|
|
|
|
+ pointDistance(
|
|
|
|
+ pointFrom(
|
|
|
|
+ pointerDownState.origin.x - rx,
|
|
|
|
+ pointerDownState.origin.y - ry,
|
|
|
|
+ ),
|
|
|
|
+ lastCommittedPoint,
|
|
|
|
+ ) < LINE_CONFIRM_THRESHOLD)
|
|
) {
|
|
) {
|
|
this.actionManager.executeAction(actionFinalize);
|
|
this.actionManager.executeAction(actionFinalize);
|
|
return;
|
|
return;
|