Further adjustments for edge cases
This commit is contained in:
@@ -951,7 +951,6 @@ export const bindPointToSnapToElementOutline = (
|
||||
otherPoint,
|
||||
),
|
||||
),
|
||||
0.1,
|
||||
)[0];
|
||||
} else {
|
||||
intersection = intersectElementWithLineSegment(
|
||||
@@ -1116,6 +1115,17 @@ export const avoidRectangularCorner = (
|
||||
);
|
||||
}
|
||||
|
||||
// Break up explicit border bindings to have better elbow arrow routing
|
||||
if (p[0] === element.x) {
|
||||
return pointFrom(p[0] - FIXED_BINDING_DISTANCE, p[1]);
|
||||
} else if (p[0] === element.x + element.width) {
|
||||
return pointFrom(p[0] + FIXED_BINDING_DISTANCE, p[1]);
|
||||
} else if (p[1] === element.y) {
|
||||
return pointFrom(p[0], p[1] - FIXED_BINDING_DISTANCE);
|
||||
} else if (p[1] === element.y + element.height) {
|
||||
return pointFrom(p[0], p[1] + FIXED_BINDING_DISTANCE);
|
||||
}
|
||||
|
||||
return p;
|
||||
};
|
||||
|
||||
|
||||
@@ -391,6 +391,10 @@ const handleSegmentRelease = (
|
||||
null,
|
||||
);
|
||||
|
||||
if (!restoredPoints) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const nextPoints: GlobalPoint[] = [];
|
||||
|
||||
// First part of the arrow are the old points
|
||||
@@ -2181,16 +2185,11 @@ const normalizeArrowElementUpdate = (
|
||||
nextFixedSegments: readonly FixedSegment[] | null,
|
||||
startIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"],
|
||||
endIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"],
|
||||
): {
|
||||
points: LocalPoint[];
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
fixedSegments: readonly FixedSegment[] | null;
|
||||
startIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"];
|
||||
endIsSpecial?: ExcalidrawElbowArrowElement["startIsSpecial"];
|
||||
} => {
|
||||
): ElementUpdate<ExcalidrawElbowArrowElement> => {
|
||||
if (global.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const offsetX = global[0][0];
|
||||
const offsetY = global[0][1];
|
||||
let points = global.map((p) =>
|
||||
|
||||
Reference in New Issue
Block a user