From c7b5cdb71ee76bb18fdbf20be9dc6c35936fd7d1 Mon Sep 17 00:00:00 2001 From: Lipis Date: Wed, 9 Dec 2020 15:03:25 +0200 Subject: [PATCH] Reduce the maximum size of the binding gap (#2450) --- src/element/collision.ts | 2 +- src/tests/binding.test.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/element/collision.ts b/src/element/collision.ts index 6d0a7ccc7..9a2d36f4e 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 6f6bc7ed6..ccd76e59b 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);