From e65fe97019ee406062304d711231d1ce7d32359b Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Tue, 10 Jun 2025 22:16:58 +0300 Subject: [PATCH] R: Replace constant with formula --- .../frontend/src/features/oss/models/oss-layout-api.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rsconcept/frontend/src/features/oss/models/oss-layout-api.ts b/rsconcept/frontend/src/features/oss/models/oss-layout-api.ts index 860e8142..74b3cfdf 100644 --- a/rsconcept/frontend/src/features/oss/models/oss-layout-api.ts +++ b/rsconcept/frontend/src/features/oss/models/oss-layout-api.ts @@ -11,8 +11,6 @@ import { type Position2D, type Rectangle2D } from './oss-layout'; export const GRID_SIZE = 10; // pixels - size of OSS grid const MIN_DISTANCE = 2 * GRID_SIZE; // pixels - minimum distance between nodes -const DISTANCE_X = 180; // pixels - insert x-distance between node centers -const DISTANCE_Y = 100; // pixels - insert y-distance between node centers const OPERATION_NODE_WIDTH = 150; const OPERATION_NODE_HEIGHT = 40; @@ -159,7 +157,7 @@ export class LayoutManager { const maxX = Math.max(...inputsPositions.map(node => node.x)); const minY = Math.min(...inputsPositions.map(node => node.y)); return { - x: maxX + DISTANCE_X, + x: maxX + OPERATION_NODE_WIDTH + MIN_DISTANCE + GRID_SIZE, y: minY }; } @@ -220,7 +218,7 @@ function calculatePositionFromArgs(args: number[], operations: IOperationPositio const maxX = Math.max(...argNodes.map(node => node.x)); return { x: Math.ceil((maxX + minX) / 2 / GRID_SIZE) * GRID_SIZE, - y: maxY + DISTANCE_Y + y: maxY + 2 * OPERATION_NODE_HEIGHT + MIN_DISTANCE }; }