2
0

perf(editor): 🚸 More predictable edge management

This commit is contained in:
Baptiste Arnaud
2022-03-25 13:31:14 +01:00
parent f3c5f6bea2
commit c507ef55ae
7 changed files with 76 additions and 24 deletions

View File

@ -27,8 +27,14 @@ export const Graph = ({
answersCounts?: AnswersCount[]
onUnlockProPlanClick?: () => void
} & FlexProps) => {
const { draggedStepType, setDraggedStepType, draggedStep, setDraggedStep } =
useStepDnd()
const {
draggedStepType,
setDraggedStepType,
draggedStep,
setDraggedStep,
draggedItem,
setDraggedItem,
} = useStepDnd()
const graphContainerRef = useRef<HTMLDivElement | null>(null)
const editorContainerRef = useRef<HTMLDivElement | null>(null)
const { createBlock } = useTypebot()
@ -77,6 +83,7 @@ export const Graph = ({
const handleMouseUp = (e: MouseEvent) => {
if (!typebot) return
if (draggedItem) setDraggedItem(undefined)
if (!draggedStep && !draggedStepType) return
const coordinates = {
x: e.clientX - graphPosition.x - blockWidth / 3,