format
continuous-integration/drone/push Build is passing Details

pull/84/head
maxime 1 year ago
parent 368acee92e
commit 6fda4d61d7

@ -116,23 +116,26 @@ export default function BendableArrow({
const styleWidth = style?.width ?? ArrowStyleDefaults.width const styleWidth = style?.width ?? ArrowStyleDefaults.width
const computeInternalSegments = useCallback((segments: Segment[]) => { const computeInternalSegments = useCallback(
return segments.map((segment, idx) => { (segments: Segment[]) => {
if (idx == 0) { 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 { return {
start: startPos, start,
controlPoint: segment.controlPoint ?? null, controlPoint: segment.controlPoint ?? null,
end: segment.next, end: segment.next,
} }
} })
const start = segments[idx - 1].next },
return { [segments, startPos],
start, )
controlPoint: segment.controlPoint ?? null,
end: segment.next,
}
})
}, [segments, startPos])
// Cache the segments so that when the user is changing the segments (it moves an ArrowPoint), // 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. // it does not unwind to this arrow's component parent until validated.
@ -151,8 +154,6 @@ export default function BendableArrow({
const headRef = useRef<HTMLDivElement>(null) const headRef = useRef<HTMLDivElement>(null)
const tailRef = useRef<HTMLDivElement>(null) const tailRef = useRef<HTMLDivElement>(null)
/** /**
* Computes and return the segments edition points * Computes and return the segments edition points
* @param parentBase * @param parentBase

Loading…
Cancel
Save