From 6fda4d61d74213c1111649385bad1f4d0ff86162 Mon Sep 17 00:00:00 2001 From: maxime Date: Mon, 8 Jan 2024 22:35:00 +0100 Subject: [PATCH] format --- front/components/arrows/BendableArrow.tsx | 31 ++++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/front/components/arrows/BendableArrow.tsx b/front/components/arrows/BendableArrow.tsx index 6ecdb44..b8f0f19 100644 --- a/front/components/arrows/BendableArrow.tsx +++ b/front/components/arrows/BendableArrow.tsx @@ -116,23 +116,26 @@ export default function BendableArrow({ const styleWidth = style?.width ?? ArrowStyleDefaults.width - const computeInternalSegments = useCallback((segments: Segment[]) => { - return segments.map((segment, idx) => { - if (idx == 0) { + const computeInternalSegments = useCallback( + (segments: Segment[]) => { + return segments.map((segment, idx) => { + if (idx == 0) { + return { + start: startPos, + controlPoint: segment.controlPoint ?? null, + end: segment.next, + } + } + const start = segments[idx - 1].next return { - start: startPos, + start, controlPoint: segment.controlPoint ?? null, end: segment.next, } - } - const start = segments[idx - 1].next - return { - start, - controlPoint: segment.controlPoint ?? null, - end: segment.next, - } - }) - }, [segments, startPos]) + }) + }, + [segments, startPos], + ) // Cache the segments so that when the user is changing the segments (it moves an ArrowPoint), // it does not unwind to this arrow's component parent until validated. @@ -151,8 +154,6 @@ export default function BendableArrow({ const headRef = useRef(null) const tailRef = useRef(null) - - /** * Computes and return the segments edition points * @param parentBase