Revert "make entire node connectable"

e304f7c5b8
This commit is contained in:
Mutasem 2021-11-03 09:31:17 +01:00
parent e304f7c5b8
commit f140fb6f93
2 changed files with 6 additions and 37 deletions

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="node-wrapper" :style="nodePosition" v-on:mouseenter="onMouseEnter" v-on:mouseleave="onMouseLeave"> <div class="node-wrapper" :style="nodePosition">
<div :class="{'selected': true, 'has-subtitles': !!nodeSubtitle}" v-show="isSelected"></div> <div :class="{'selected': true, 'has-subtitles': !!nodeSubtitle}" v-show="isSelected"></div>
<div class="node-default" :ref="data.name" :style="nodeStyle" :class="nodeClass" @dblclick="setNodeActive" @click.left="mouseLeftClick" v-touch:start="touchStart" v-touch:end="touchEnd"> <div class="node-default" :ref="data.name" :style="nodeStyle" :class="nodeClass" @dblclick="setNodeActive" @click.left="mouseLeftClick" v-touch:start="touchStart" v-touch:end="touchEnd">
<div v-if="hasIssues" class="node-info-icon node-issues"> <div v-if="hasIssues" class="node-info-icon node-issues">
@ -248,12 +248,6 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext
}, 2000); }, 2000);
} }
}, },
onMouseEnter () {
this.$emit('mouseenter', this.data.name);
},
onMouseLeave () {
this.$emit('mouseleave', this.data.name);
},
}, },
}); });

View file

@ -23,8 +23,6 @@
@runWorkflow="runWorkflow" @runWorkflow="runWorkflow"
@moved="onNodeMoved" @moved="onNodeMoved"
@run="onNodeRun" @run="onNodeRun"
@mouseenter="onNodeEnter"
@mouseleave="onNodeLeave"
:id="'node-' + getNodeIndex(nodeData.name)" :id="'node-' + getNodeIndex(nodeData.name)"
:key="getNodeIndex(nodeData.name)" :key="getNodeIndex(nodeData.name)"
:name="nodeData.name" :name="nodeData.name"
@ -312,7 +310,6 @@ export default mixins(
blankRedirect: false, blankRedirect: false,
credentialsUpdated: false, credentialsUpdated: false,
newNodeInsertPosition: null as null | XYPosition, newNodeInsertPosition: null as null | XYPosition,
hoveringOverNodeName: null as null | string,
}; };
}, },
beforeDestroy () { beforeDestroy () {
@ -1271,23 +1268,15 @@ export default mixins(
let dropPrevented = false; let dropPrevented = false;
this.instance.bind('connectionAborted', (connection) => { this.instance.bind('connectionAborted', (info) => {
if (dropPrevented) { if (dropPrevented) {
dropPrevented = false; dropPrevented = false;
return; return;
} }
if (this.hoveringOverNodeName) {
const sourceNodeName = this.$store.getters.getNodeNameByIndex(connection.sourceId.slice(NODE_NAME_PREFIX.length));
const outputIndex = connection.getParameters().index;
this.connectTwoNodes(sourceNodeName, outputIndex, this.hoveringOverNodeName, 0);
return;
}
insertNodeAfterSelected({ insertNodeAfterSelected({
sourceId: connection.sourceId, sourceId: info.sourceId,
index: connection.getParameters().index, index: info.getParameters().index,
eventSource: 'node_connection_drop', eventSource: 'node_connection_drop',
}); });
}); });
@ -1466,19 +1455,11 @@ export default mixins(
} }
const elements = document.querySelector('div.jtk-endpoint.dropHover'); const elements = document.querySelector('div.jtk-endpoint.dropHover');
if ((elements || this.hoveringOverNodeName) && !droppable) { if (elements && !droppable) {
if (!elements && this.hoveringOverNodeName) {
const node = this.$store.getters.getNodeByName(this.hoveringOverNodeName);
const type: INodeTypeDescription = this.$store.getters.nodeType(node.type);
if (type.inputs.length !== 1) { // only attach to simple nodes with 1 input
return;
}
}
droppable = true; droppable = true;
CanvasHelpers.showDropConnectionState(connection); CanvasHelpers.showDropConnectionState(connection);
} }
else if (!(elements || this.hoveringOverNodeName) && droppable) { else if (!elements && droppable) {
droppable = false; droppable = false;
CanvasHelpers.showPullConnectionState(connection); CanvasHelpers.showPullConnectionState(connection);
} }
@ -1722,12 +1703,6 @@ export default mixins(
CanvasHelpers.showOrHideItemsLabel(connection); CanvasHelpers.showOrHideItemsLabel(connection);
}); });
}, },
onNodeEnter (nodeName: string) {
this.hoveringOverNodeName = nodeName;
},
onNodeLeave () {
this.hoveringOverNodeName = null;
},
onNodeRun ({name, data}: {name: string, data: ITaskData[] | null}) { onNodeRun ({name, data}: {name: string, data: ITaskData[] | null}) {
const sourceNodeName = name; const sourceNodeName = name;
const sourceIndex = this.$store.getters.getNodeIndex(sourceNodeName); const sourceIndex = this.$store.getters.getNodeIndex(sourceNodeName);