From 3e8e7329427533e1edd8d8e607feb32040ce78ea Mon Sep 17 00:00:00 2001 From: frikky Date: Mon, 4 Oct 2021 16:02:51 +0200 Subject: [PATCH] Fixed draggable info window slightly --- frontend/src/views/AngularWorkflow.jsx | 31 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index b74468e4..ddc145bb 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -1944,6 +1944,7 @@ const AngularWorkflow = (props) => { newNodeData.errors = [] newNodeData.is_valid = true newNodeData.isValid = true + newNodeData.label = parentNode.data("label")+"_copy" cy.add({ group: 'nodes', @@ -8436,30 +8437,39 @@ const AngularWorkflow = (props) => { //console.log(selectedResult) const codePopoutModal = !codeModalOpen ? null : { + //onDrag={(e) => { + // if (!dragging) { + // console.log("START") + // setDragging(true) + // } + //}} + onStart={(e) => { if (!dragging) { + console.log("START") setDragging(true) } }} onStop={(e) => { + console.log("STOP") if (!dragging) { return } setDragging(false) - const newoffsetX = parseInt(dragPosition.x)-parseInt(e.layerX-e.offsetX) const newoffsetY = parseInt(dragPosition.y)-parseInt(e.layerY-e.offsetY) if ((newoffsetX <= 40 && newoffsetX >= -40) && (newoffsetY <= 40 && newoffsetY >= -40)) { console.log("SKIP X & Y") return } - - setDragPosition({ + + const newPosition = { x: e.layerX-e.offsetX, y: e.layerY-e.offsetY, - }) + } + setDragPosition(newPosition) }} + //disabled={!newdragging} position={dragPosition} > { }, }} > + {/* + + { + //console.log("MOUSE DOWN IN HERE") + //setDragging(true) + //newdragging = true + }}> + + + + */} { e.preventDefault()