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>
<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="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">
@ -248,12 +248,6 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext
}, 2000);
}
},
onMouseEnter () {
this.$emit('mouseenter', this.data.name);
},
onMouseLeave () {
this.$emit('mouseleave', this.data.name);
},
},
});

View file

@ -23,8 +23,6 @@
@runWorkflow="runWorkflow"
@moved="onNodeMoved"
@run="onNodeRun"
@mouseenter="onNodeEnter"
@mouseleave="onNodeLeave"
:id="'node-' + getNodeIndex(nodeData.name)"
:key="getNodeIndex(nodeData.name)"
:name="nodeData.name"
@ -312,7 +310,6 @@ export default mixins(
blankRedirect: false,
credentialsUpdated: false,
newNodeInsertPosition: null as null | XYPosition,
hoveringOverNodeName: null as null | string,
};
},
beforeDestroy () {
@ -1271,23 +1268,15 @@ export default mixins(
let dropPrevented = false;
this.instance.bind('connectionAborted', (connection) => {
this.instance.bind('connectionAborted', (info) => {
if (dropPrevented) {
dropPrevented = false;
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({
sourceId: connection.sourceId,
index: connection.getParameters().index,
sourceId: info.sourceId,
index: info.getParameters().index,
eventSource: 'node_connection_drop',
});
});
@ -1466,19 +1455,11 @@ export default mixins(
}
const elements = document.querySelector('div.jtk-endpoint.dropHover');
if ((elements || this.hoveringOverNodeName) && !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;
}
}
if (elements && !droppable) {
droppable = true;
CanvasHelpers.showDropConnectionState(connection);
}
else if (!(elements || this.hoveringOverNodeName) && droppable) {
else if (!elements && droppable) {
droppable = false;
CanvasHelpers.showPullConnectionState(connection);
}
@ -1722,12 +1703,6 @@ export default mixins(
CanvasHelpers.showOrHideItemsLabel(connection);
});
},
onNodeEnter (nodeName: string) {
this.hoveringOverNodeName = nodeName;
},
onNodeLeave () {
this.hoveringOverNodeName = null;
},
onNodeRun ({name, data}: {name: string, data: ITaskData[] | null}) {
const sourceNodeName = name;
const sourceIndex = this.$store.getters.getNodeIndex(sourceNodeName);