diff --git a/client/src/components/Workflow/Editor/Draggable.vue b/client/src/components/Workflow/Editor/Draggable.vue index bc55f8f14a0a..50948620228e 100644 --- a/client/src/components/Workflow/Editor/Draggable.vue +++ b/client/src/components/Workflow/Editor/Draggable.vue @@ -32,6 +32,10 @@ const props = defineProps({ type: Boolean, default: false, }, + snappable: { + type: Boolean, + default: true, + }, }); const emit = defineEmits<{ @@ -81,7 +85,7 @@ const { toolbarStore } = useWorkflowStores(); const { snapActive } = storeToRefs(toolbarStore); function getSnappedPosition(position: T) { - if (snapActive.value) { + if (props.snappable && snapActive.value) { return { ...position, x: Math.round(position.x / toolbarStore.snapDistance) * toolbarStore.snapDistance, diff --git a/client/src/components/Workflow/Editor/DraggablePan.vue b/client/src/components/Workflow/Editor/DraggablePan.vue index c9a72bfac19b..1da2acce6632 100644 --- a/client/src/components/Workflow/Editor/DraggablePan.vue +++ b/client/src/components/Workflow/Editor/DraggablePan.vue @@ -35,6 +35,10 @@ const props = defineProps({ type: Number, default: 60, }, + snappable: { + type: Boolean, + default: true, + }, }); type Position = { x: number; y: number }; @@ -157,6 +161,7 @@ function onStart() { :stop-propagation="stopPropagation" :drag-data="dragData" :disabled="disabled" + :snappable="snappable" @move="onMove" @mouseup="onMouseUp" @start="onStart" diff --git a/client/src/components/Workflow/Editor/NodeInput.vue b/client/src/components/Workflow/Editor/NodeInput.vue index 63ce71806384..81e5dbcd8c1e 100644 --- a/client/src/components/Workflow/Editor/NodeInput.vue +++ b/client/src/components/Workflow/Editor/NodeInput.vue @@ -2,7 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faChevronCircleRight, faMinusSquare } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import type { UseElementBoundingReturn } from "@vueuse/core"; +import { useDebounce, type UseElementBoundingReturn } from "@vueuse/core"; import { storeToRefs } from "pinia"; import { computed, @@ -188,10 +188,31 @@ function onDrop(event: DragEvent) { terminal.value.connect(droppedTerminal); } } + +const draggedOver = ref(false); +const draggedOverDebounced = useDebounce(draggedOver, 50); + +function nodeDragOver() { + draggedOver.value = true && Boolean(draggingTerminal.value); +} + +function nodeDragOut() { + draggedOver.value = false; +} + +watch( + () => draggingTerminal.value, + () => { + if (!draggingTerminal.value) { + draggedOver.value = false; + } + } +);