Binding gap correctly represent the area where the arrow can bind

This commit is contained in:
Mark Tolmacs 2025-04-16 19:55:50 +02:00
parent e51e72c676
commit 3054be4c20
No known key found for this signature in database

View file

@ -17,7 +17,6 @@ import {
import { import {
BINDING_HIGHLIGHT_OFFSET, BINDING_HIGHLIGHT_OFFSET,
BINDING_HIGHLIGHT_THICKNESS,
maxBindingGap, maxBindingGap,
} from "@excalidraw/element/binding"; } from "@excalidraw/element/binding";
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor"; import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
@ -261,9 +260,9 @@ const renderBindingHighlightForBindableElement = (
const height = y2 - y1; const height = y2 - y1;
context.strokeStyle = "rgba(0,0,0,.05)"; context.strokeStyle = "rgba(0,0,0,.05)";
// When zooming out, make line width greater for visibility context.lineWidth =
const zoomValue = zoom.value < 1 ? zoom.value : 1; maxBindingGap(element, element.width, element.height, zoom) -
context.lineWidth = BINDING_HIGHLIGHT_THICKNESS / zoomValue; BINDING_HIGHLIGHT_OFFSET;
// To ensure the binding highlight doesn't overlap the element itself // To ensure the binding highlight doesn't overlap the element itself
const padding = context.lineWidth / 2 + BINDING_HIGHLIGHT_OFFSET; const padding = context.lineWidth / 2 + BINDING_HIGHLIGHT_OFFSET;