feat(editor): Improve sticky note experience on new canvas (no-changelog) (#11010)

This commit is contained in:
Alex Grozav
2024-09-30 13:27:37 +03:00
committed by GitHub
parent 6120b3a053
commit c09ae3c18c
8 changed files with 353 additions and 77 deletions

View File

@@ -1,6 +1,6 @@
import type { IConnection, IConnections, INodeTypeDescription } from 'n8n-workflow';
import type { INodeUi } from '@/Interface';
import type { CanvasConnection, CanvasConnectionPort } from '@/types';
import type { BoundingBox, CanvasConnection, CanvasConnectionPort } from '@/types';
import { CanvasConnectionMode } from '@/types';
import type { Connection } from '@vue-flow/core';
import { v4 as uuid } from 'uuid';
@@ -207,3 +207,18 @@ export function getUniqueNodeName(name: string, existingNames: Set<string>): str
return `${name} ${uuid()}`;
}
export function checkOverlap(node1: BoundingBox, node2: BoundingBox) {
return !(
// node1 is completely to the left of node2
(
node1.x + node1.width <= node2.x ||
// node2 is completely to the left of node1
node2.x + node2.width <= node1.x ||
// node1 is completely above node2
node1.y + node1.height <= node2.y ||
// node2 is completely above node1
node2.y + node2.height <= node1.y
)
);
}