Fixed draggable info window slightly

This commit is contained in:
frikky
2021-10-04 16:02:51 +02:00
parent 7e1c2487a2
commit 3e8e732942
+26 -5
View File
@@ -1944,6 +1944,7 @@ const AngularWorkflow = (props) => {
newNodeData.errors = [] newNodeData.errors = []
newNodeData.is_valid = true newNodeData.is_valid = true
newNodeData.isValid = true newNodeData.isValid = true
newNodeData.label = parentNode.data("label")+"_copy"
cy.add({ cy.add({
group: 'nodes', group: 'nodes',
@@ -8436,30 +8437,39 @@ const AngularWorkflow = (props) => {
//console.log(selectedResult) //console.log(selectedResult)
const codePopoutModal = !codeModalOpen ? null : const codePopoutModal = !codeModalOpen ? null :
<Draggable <Draggable
onDrag={(e) => { //onDrag={(e) => {
// if (!dragging) {
// console.log("START")
// setDragging(true)
// }
//}}
onStart={(e) => {
if (!dragging) { if (!dragging) {
console.log("START")
setDragging(true) setDragging(true)
} }
}} }}
onStop={(e) => { onStop={(e) => {
console.log("STOP")
if (!dragging) { if (!dragging) {
return return
} }
setDragging(false) setDragging(false)
const newoffsetX = parseInt(dragPosition.x)-parseInt(e.layerX-e.offsetX) const newoffsetX = parseInt(dragPosition.x)-parseInt(e.layerX-e.offsetX)
const newoffsetY = parseInt(dragPosition.y)-parseInt(e.layerY-e.offsetY) const newoffsetY = parseInt(dragPosition.y)-parseInt(e.layerY-e.offsetY)
if ((newoffsetX <= 40 && newoffsetX >= -40) && (newoffsetY <= 40 && newoffsetY >= -40)) { if ((newoffsetX <= 40 && newoffsetX >= -40) && (newoffsetY <= 40 && newoffsetY >= -40)) {
console.log("SKIP X & Y") console.log("SKIP X & Y")
return return
} }
setDragPosition({ const newPosition = {
x: e.layerX-e.offsetX, x: e.layerX-e.offsetX,
y: e.layerY-e.offsetY, y: e.layerY-e.offsetY,
}) }
setDragPosition(newPosition)
}} }}
//disabled={!newdragging}
position={dragPosition} position={dragPosition}
> >
<Dialog <Dialog
@@ -8481,6 +8491,17 @@ const AngularWorkflow = (props) => {
}, },
}} }}
> >
{/*
<Tooltip title="Move window" placement="top">
<IconButton style={{zIndex: 5000, position: "absolute", cursor: "grab", top: 34, right: 204,}} onMouseDown={(e) => {
//console.log("MOUSE DOWN IN HERE")
//setDragging(true)
//newdragging = true
}}>
<DoneIcon style={{color: "white"}}/>
</IconButton>
</Tooltip>
*/}
<Tooltip title="Find successful execution" placement="top"> <Tooltip title="Find successful execution" placement="top">
<IconButton style={{zIndex: 5000, position: "absolute", top: 34, right: 170,}} onClick={(e) => { <IconButton style={{zIndex: 5000, position: "absolute", top: 34, right: 170,}} onClick={(e) => {
e.preventDefault() e.preventDefault()