mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
🐛 Fix bug with connections deleted when node is renamed (#2467)
* fix bug when node is renamed * update comment * support touch when dragging
This commit is contained in:
parent
889921f5fe
commit
5fd3f8a244
|
@ -74,7 +74,7 @@ export const nodeBase = mixins(
|
|||
type: inputName,
|
||||
index,
|
||||
},
|
||||
enabled: !this.isReadOnly,
|
||||
enabled: !this.isReadOnly && nodeTypeData.inputs.length > 1, // only enabled for nodes with multiple inputs.. otherwise attachment handled by connectionDrag event in NodeView
|
||||
dragAllowedWhenFull: true,
|
||||
dropOptions: {
|
||||
tolerance: 'touch',
|
||||
|
|
|
@ -1522,7 +1522,7 @@ export default mixins(
|
|||
CanvasHelpers.addOverlays(connection, CanvasHelpers.CONNECTOR_DROP_NODE_OVERLAY);
|
||||
const nodes = [...document.querySelectorAll('.node-default')];
|
||||
|
||||
const onMouseMove = (e: MouseEvent) => {
|
||||
const onMouseMove = (e: MouseEvent | TouchEvent) => {
|
||||
if (!connection) {
|
||||
return;
|
||||
}
|
||||
|
@ -1537,7 +1537,8 @@ export default mixins(
|
|||
const inputMargin = 24;
|
||||
const intersecting = nodes.find((element: Element) => {
|
||||
const {top, left, right, bottom} = element.getBoundingClientRect();
|
||||
if (top <= e.pageY && bottom >= e.pageY && (left - inputMargin) <= e.pageX && right >= e.pageX) {
|
||||
const [x, y] = CanvasHelpers.getMousePosition(e);
|
||||
if (top <= y && bottom >= y && (left - inputMargin) <= x && right >= x) {
|
||||
const nodeName = (element as HTMLElement).dataset['name'] as string;
|
||||
const node = this.$store.getters.getNodeByName(nodeName) as INodeUi | null;
|
||||
if (node) {
|
||||
|
@ -1562,7 +1563,7 @@ export default mixins(
|
|||
}
|
||||
};
|
||||
|
||||
const onMouseUp = (e: MouseEvent) => {
|
||||
const onMouseUp = (e: MouseEvent | TouchEvent) => {
|
||||
this.pullConnActive = false;
|
||||
this.newNodeInsertPosition = this.getMousePositionWithinNodeView(e);
|
||||
CanvasHelpers.resetConnectionAfterPull(connection);
|
||||
|
@ -1571,7 +1572,9 @@ export default mixins(
|
|||
};
|
||||
|
||||
window.addEventListener('mousemove', onMouseMove);
|
||||
window.addEventListener('touchmove', onMouseMove);
|
||||
window.addEventListener('mouseup', onMouseUp);
|
||||
window.addEventListener('touchend', onMouseMove);
|
||||
} catch (e) {
|
||||
console.error(e); // eslint-disable-line no-console
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue