Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

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

Lipisc7b5cdb71ee7
diff --git a/src/element/collision.ts b/src/element/collision.ts
index 6d0a7ccc7e..9a2d36f4ee 100644
--- a/src/element/collision.ts
+++ b/src/element/collision.ts
@@ -133,7 +133,7 @@ export const maxBindingGap = (
const shapeRatio = element.type === "diamond" ? 1 / Math.sqrt(2) : 1;
const smallerDimension = shapeRatio * Math.min(elementWidth, elementHeight);
// 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 = {
diff --git a/src/tests/binding.test.tsx b/src/tests/binding.test.tsx
index 6f6bc7ed64..ccd76e59bc 100644
--- a/src/tests/binding.test.tsx
+++ b/src/tests/binding.test.tsx
@@ -27,9 +27,9 @@ describe("element binding", () => {
height: 500,
});
const arrow = UI.createElement("arrow", {
- x: 220,
+ x: 210,
y: 250,
- width: 160,
+ width: 180,
height: 1,
});
expect(arrow.startBinding?.elementId).toBe(rectLeft.id);