mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 02:51:14 +00:00
fix(editor): Make adjustments to status icon and connector port position in canvas (#16469)
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
AI_MCP_TOOL_NODE_TYPE,
|
||||
LIST_LIKE_NODE_OPERATIONS,
|
||||
MAIN_HEADER_TABS,
|
||||
NODE_MIN_INPUT_ITEMS_COUNT,
|
||||
NODE_POSITION_CONFLICT_ALLOWLIST,
|
||||
SET_NODE_TYPE,
|
||||
SPLIT_IN_BATCHES_NODE_TYPE,
|
||||
@@ -33,14 +34,14 @@ import {
|
||||
|
||||
export const GRID_SIZE = 20;
|
||||
|
||||
export const NODE_SIZE = 100;
|
||||
export const DEFAULT_NODE_SIZE: [number, number] = [100, 100];
|
||||
export const CONFIGURATION_NODE_SIZE: [number, number] = [80, 80];
|
||||
export const CONFIGURABLE_NODE_SIZE: [number, number] = [256, 100];
|
||||
export const DEFAULT_START_POSITION_X = 180;
|
||||
export const DEFAULT_START_POSITION_Y = 240;
|
||||
export const NODE_SIZE = GRID_SIZE * 5;
|
||||
export const DEFAULT_NODE_SIZE: [number, number] = [GRID_SIZE * 5, GRID_SIZE * 5];
|
||||
export const CONFIGURATION_NODE_SIZE: [number, number] = [GRID_SIZE * 4, GRID_SIZE * 4];
|
||||
export const CONFIGURABLE_NODE_SIZE: [number, number] = [GRID_SIZE * 12, GRID_SIZE * 5];
|
||||
export const DEFAULT_START_POSITION_X = GRID_SIZE * 9;
|
||||
export const DEFAULT_START_POSITION_Y = GRID_SIZE * 12;
|
||||
export const HEADER_HEIGHT = 65;
|
||||
export const MAX_X_TO_PUSH_DOWNSTREAM_NODES = 300;
|
||||
export const MAX_X_TO_PUSH_DOWNSTREAM_NODES = GRID_SIZE * 15;
|
||||
export const PUSH_NODES_OFFSET = NODE_SIZE * 2 + GRID_SIZE;
|
||||
export const DEFAULT_VIEWPORT_BOUNDARIES: ViewportBoundaries = {
|
||||
xMin: -Infinity,
|
||||
@@ -600,3 +601,27 @@ export function updateViewportToContainNodes(
|
||||
zoom,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateNodeSize(
|
||||
isConfiguration: boolean,
|
||||
isConfigurable: boolean,
|
||||
mainInputCount: number,
|
||||
mainOutputCount: number,
|
||||
nonMainInputCount: number,
|
||||
): { width: number; height: number } {
|
||||
const maxVerticalHandles = Math.max(mainInputCount, mainOutputCount, 1);
|
||||
const height = 100 + Math.max(0, maxVerticalHandles - 3) * GRID_SIZE * 2;
|
||||
|
||||
if (isConfigurable) {
|
||||
return {
|
||||
width: (Math.max(NODE_MIN_INPUT_ITEMS_COUNT - 1, nonMainInputCount) * 2 + 4) * GRID_SIZE,
|
||||
height: isConfiguration ? 75 : height,
|
||||
};
|
||||
}
|
||||
|
||||
if (isConfiguration) {
|
||||
return { width: GRID_SIZE * 4, height: GRID_SIZE * 4 };
|
||||
}
|
||||
|
||||
return { width: 100, height };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user