Skip to content

Commit

Permalink
Merge pull request #32 from MertenD/25-prevent-node-deletion-during-c…
Browse files Browse the repository at this point in the history
…rawler-execution

fix: disable all interactivity when process running
  • Loading branch information
MertenD authored Aug 4, 2023
2 parents 9dc065a + 3e7c4ff commit b0e1eff
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/editor/pages/canvas/DragAndDropFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export default function DragAndDropFlow() {
const [lastEventPosition, setLastEventPosition] = useState<{x: number, y: number}>({x: 0, y: 0})

const isProcessRunning = usePlayStore(state => state.isProcessRunning)
const isStepByStep = usePlayStore(state => state.isStepByStep)
const isNextStepReady = usePlayStore(state => state.isNextStepReady)

const onDragOver = useCallback((event: any) => {
event.preventDefault();
Expand Down Expand Up @@ -142,10 +144,12 @@ export default function DragAndDropFlow() {
}}
deleteKeyCode={["Backspace", "Delete"]}
onSelectionChange={setSelectedNodes}
edgesUpdatable={!isProcessRunning}
edgesFocusable={!isProcessRunning}
nodesDraggable={!isProcessRunning}
nodesConnectable={!isProcessRunning}
edgesUpdatable={isProcessRunning ? (isStepByStep ? isNextStepReady : false) : true}
edgesFocusable={isProcessRunning ? (isStepByStep ? isNextStepReady : false) : true}
nodesDraggable={isProcessRunning ? (isStepByStep ? isNextStepReady : false) : true}
nodesConnectable={isProcessRunning ? (isStepByStep ? isNextStepReady : false) : true}
nodesFocusable={isProcessRunning ? (isStepByStep ? isNextStepReady : false) : true}
elementsSelectable={isProcessRunning ? (isStepByStep ? isNextStepReady : false) : true}
>
<Controls />
<Background variant={BackgroundVariant.Dots} />
Expand Down

0 comments on commit b0e1eff

Please sign in to comment.