Skip to content

Commit e17cdc9

Browse files
committed
fix(formatting): fixed widths & heights for auto-formatting
1 parent 4239810 commit e17cdc9

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

apps/sim/app/w/[id]/components/workflow-edge/workflow-edge.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export const WorkflowEdge = ({
1212
data,
1313
style,
1414
}: EdgeProps) => {
15+
const isHorizontal = sourcePosition === 'right' || sourcePosition === 'left'
16+
1517
const [edgePath, labelX, labelY] = getSmoothStepPath({
1618
sourceX,
1719
sourceY,
@@ -20,7 +22,7 @@ export const WorkflowEdge = ({
2022
targetY,
2123
targetPosition,
2224
borderRadius: 8,
23-
offset: 10,
25+
offset: isHorizontal ? 30 : 20,
2426
})
2527

2628
// Use the directly provided isSelected flag instead of computing it

apps/sim/app/w/[id]/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,13 +721,13 @@ export const calculateAutoLayout = (
721721

722722
const baseSpacing = horizontalSpacing
723723
const widthAdjustment = Math.max(maxCurrentWidth, maxNextWidth) - 350 // 350 is standard width
724-
const connectionTagSpace = 50 // Reduced from 100 - Extra space for connection tags
724+
const connectionTagSpace = 100
725725

726726
const isOrphanedLayer =
727727
currentLayer > maxLayer - 2 &&
728728
(currentLayerGroups.some((group) => group.some((nodeId) => orphanedBlocks.has(nodeId))) ||
729729
nextLayerGroups.some((group) => group.some((nodeId) => orphanedBlocks.has(nodeId))))
730-
const orphanedSpacing = isOrphanedLayer ? 100 : 0
730+
const orphanedSpacing = isOrphanedLayer ? 200 : 0
731731

732732
return baseSpacing + widthAdjustment + connectionTagSpace + orphanedSpacing
733733
}
@@ -837,13 +837,13 @@ export const calculateAutoLayout = (
837837

838838
const baseSpacing = verticalSpacing
839839
const heightAdjustment = Math.max(maxCurrentHeight, maxNextHeight) - 150 // 150 is standard height
840-
const connectionTagSpace = 25
840+
const connectionTagSpace = 50
841841

842842
const isOrphanedLayer =
843843
currentLayer > maxLayer - 2 &&
844844
(currentLayerGroups.some((group) => group.some((nodeId) => orphanedBlocks.has(nodeId))) ||
845845
nextLayerGroups.some((group) => group.some((nodeId) => orphanedBlocks.has(nodeId))))
846-
const orphanedSpacing = isOrphanedLayer ? 75 : 0
846+
const orphanedSpacing = isOrphanedLayer ? 150 : 0
847847

848848
return baseSpacing + heightAdjustment + connectionTagSpace + orphanedSpacing
849849
}

apps/sim/app/w/[id]/workflow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ function WorkflowContent() {
159159
? {
160160
// Vertical handles: optimize for top-to-bottom flow
161161
horizontalSpacing: 400,
162-
verticalSpacing: 150,
162+
verticalSpacing: 300,
163163
startX: 200,
164164
startY: 200,
165165
}
166166
: {
167167
// Horizontal handles: optimize for left-to-right flow
168-
horizontalSpacing: 300,
168+
horizontalSpacing: 600,
169169
verticalSpacing: 200,
170170
startX: 150,
171171
startY: 300,

0 commit comments

Comments
 (0)