Reduce the maximum size of the binding gap (#2450)

pull/2499/head
Lipis 4 years ago committed by GitHub
parent 4d71078f48
commit c7b5cdb71e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -133,7 +133,7 @@ export const maxBindingGap = (
const shapeRatio = element.type === "diamond" ? 1 / Math.sqrt(2) : 1; const shapeRatio = element.type === "diamond" ? 1 / Math.sqrt(2) : 1;
const smallerDimension = shapeRatio * Math.min(elementWidth, elementHeight); const smallerDimension = shapeRatio * Math.min(elementWidth, elementHeight);
// We make the bindable boundary bigger for bigger elements // We make the bindable boundary bigger for bigger elements
return Math.max(15, Math.min(0.25 * smallerDimension, 80)); return Math.max(16, Math.min(0.25 * smallerDimension, 32));
}; };
type HitTestArgs = { type HitTestArgs = {

@ -27,9 +27,9 @@ describe("element binding", () => {
height: 500, height: 500,
}); });
const arrow = UI.createElement("arrow", { const arrow = UI.createElement("arrow", {
x: 220, x: 210,
y: 250, y: 250,
width: 160, width: 180,
height: 1, height: 1,
}); });
expect(arrow.startBinding?.elementId).toBe(rectLeft.id); expect(arrow.startBinding?.elementId).toBe(rectLeft.id);

Loading…
Cancel
Save