@yanqirenshi/d3.pad 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -18
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -6
- package/dist/pad/Pad.d.ts +21 -0
- package/dist/pad/Pad.d.ts.map +1 -0
- package/dist/pad/Pad.js +139 -0
- package/dist/pad/PadDiagram.d.ts +19 -0
- package/dist/pad/PadDiagram.d.ts.map +1 -0
- package/dist/pad/PadDiagram.js +64 -0
- package/dist/pad/Theme.d.ts +7 -0
- package/dist/pad/Theme.d.ts.map +1 -0
- package/dist/pad/Theme.js +10 -0
- package/dist/pad/datamodels/Assignment.d.ts +81 -0
- package/dist/pad/datamodels/Assignment.d.ts.map +1 -0
- package/dist/pad/datamodels/Assignment.js +51 -0
- package/dist/pad/datamodels/Call.d.ts +95 -0
- package/dist/pad/datamodels/Call.d.ts.map +1 -0
- package/dist/pad/datamodels/Call.js +83 -0
- package/dist/pad/datamodels/Connector.d.ts +35 -0
- package/dist/pad/datamodels/Connector.d.ts.map +1 -0
- package/dist/pad/datamodels/Connector.js +23 -0
- package/dist/pad/datamodels/Group.d.ts +78 -0
- package/dist/pad/datamodels/Group.d.ts.map +1 -0
- package/dist/pad/datamodels/Group.js +71 -0
- package/dist/pad/datamodels/Loop.d.ts +80 -0
- package/dist/pad/datamodels/Loop.d.ts.map +1 -0
- package/dist/pad/datamodels/Loop.js +77 -0
- package/dist/pad/datamodels/Parallel.d.ts +85 -0
- package/dist/pad/datamodels/Parallel.d.ts.map +1 -0
- package/dist/pad/datamodels/Parallel.js +80 -0
- package/dist/pad/datamodels/Process.d.ts +79 -0
- package/dist/pad/datamodels/Process.d.ts.map +1 -0
- package/dist/pad/datamodels/Process.js +59 -0
- package/dist/pad/datamodels/Selection.d.ts +76 -0
- package/dist/pad/datamodels/Selection.d.ts.map +1 -0
- package/dist/pad/datamodels/Selection.js +81 -0
- package/dist/pad/datamodels/Terminal.d.ts +61 -0
- package/dist/pad/datamodels/Terminal.d.ts.map +1 -0
- package/dist/pad/datamodels/Terminal.js +50 -0
- package/dist/pad/elements.d.ts +2 -0
- package/dist/pad/elements.d.ts.map +1 -0
- package/dist/pad/elements.js +32 -0
- package/dist/pad/painters/Assignment.d.ts +4 -0
- package/dist/pad/painters/Assignment.d.ts.map +1 -0
- package/dist/pad/painters/Assignment.js +72 -0
- package/dist/pad/painters/Call.d.ts +4 -0
- package/dist/pad/painters/Call.d.ts.map +1 -0
- package/dist/pad/painters/Call.js +134 -0
- package/dist/pad/painters/Connector.d.ts +4 -0
- package/dist/pad/painters/Connector.d.ts.map +1 -0
- package/dist/pad/painters/Connector.js +15 -0
- package/dist/pad/painters/Group.d.ts +4 -0
- package/dist/pad/painters/Group.d.ts.map +1 -0
- package/dist/pad/painters/Group.js +99 -0
- package/dist/pad/painters/Loop.d.ts +4 -0
- package/dist/pad/painters/Loop.d.ts.map +1 -0
- package/dist/pad/painters/Loop.js +126 -0
- package/dist/pad/painters/Parallel.d.ts +4 -0
- package/dist/pad/painters/Parallel.d.ts.map +1 -0
- package/dist/pad/painters/Parallel.js +102 -0
- package/dist/pad/painters/Process.d.ts +5 -0
- package/dist/pad/painters/Process.d.ts.map +1 -0
- package/dist/pad/painters/Process.js +132 -0
- package/dist/pad/painters/Selection.d.ts +4 -0
- package/dist/pad/painters/Selection.d.ts.map +1 -0
- package/dist/pad/painters/Selection.js +126 -0
- package/dist/pad/painters/Terminal.d.ts +4 -0
- package/dist/pad/painters/Terminal.d.ts.map +1 -0
- package/dist/pad/painters/Terminal.js +19 -0
- package/dist/pad/painters/interactive.d.ts +2 -0
- package/dist/pad/painters/interactive.d.ts.map +1 -0
- package/dist/pad/painters/interactive.js +15 -0
- package/dist/pad/registry.d.ts +14 -0
- package/dist/pad/registry.d.ts.map +1 -0
- package/dist/pad/registry.js +25 -0
- package/package.json +7 -5
- package/src/index.ts +15 -7
- package/src/pad/Pad.ts +157 -0
- package/src/pad/PadDiagram.tsx +126 -0
- package/src/pad/Theme.ts +11 -0
- package/src/pad/datamodels/Assignment.ts +55 -0
- package/src/pad/datamodels/Call.ts +91 -0
- package/src/pad/datamodels/Connector.ts +25 -0
- package/src/pad/datamodels/Group.ts +76 -0
- package/src/pad/datamodels/Loop.ts +82 -0
- package/src/pad/datamodels/Parallel.ts +85 -0
- package/src/pad/datamodels/Process.ts +63 -0
- package/src/pad/datamodels/Selection.ts +87 -0
- package/src/pad/datamodels/Terminal.ts +57 -0
- package/src/pad/elements.ts +34 -0
- package/src/pad/painters/Assignment.ts +87 -0
- package/src/pad/painters/Call.ts +152 -0
- package/src/pad/painters/Connector.ts +15 -0
- package/src/pad/painters/Group.ts +116 -0
- package/src/pad/painters/Loop.ts +144 -0
- package/src/pad/painters/Parallel.ts +115 -0
- package/src/pad/painters/Process.ts +153 -0
- package/src/pad/painters/Selection.ts +150 -0
- package/src/pad/painters/Terminal.ts +23 -0
- package/src/pad/painters/interactive.ts +15 -0
- package/src/pad/registry.ts +38 -0
- package/dist/renderers/D3PadRenderer.d.ts +0 -34
- package/dist/renderers/D3PadRenderer.d.ts.map +0 -1
- package/dist/renderers/D3PadRenderer.js +0 -112
- package/dist/renderers/PadNodeRenderer.d.ts +0 -145
- package/dist/renderers/PadNodeRenderer.d.ts.map +0 -1
- package/dist/renderers/PadNodeRenderer.js +0 -440
- package/dist/renderers/blocks/EndBlockGeometry.d.ts +0 -33
- package/dist/renderers/blocks/EndBlockGeometry.d.ts.map +0 -1
- package/dist/renderers/blocks/EndBlockGeometry.js +0 -44
- package/dist/renderers/blocks/EndRenderer.d.ts +0 -10
- package/dist/renderers/blocks/EndRenderer.d.ts.map +0 -1
- package/dist/renderers/blocks/EndRenderer.js +0 -38
- package/dist/renderers/blocks/EndRendererProps.d.ts +0 -6
- package/dist/renderers/blocks/EndRendererProps.d.ts.map +0 -1
- package/dist/renderers/blocks/EndRendererProps.js +0 -1
- package/dist/renderers/blocks/FunctionContainerGeometry.d.ts +0 -29
- package/dist/renderers/blocks/FunctionContainerGeometry.d.ts.map +0 -1
- package/dist/renderers/blocks/FunctionContainerGeometry.js +0 -46
- package/dist/renderers/blocks/FunctionContainerRenderer.d.ts +0 -13
- package/dist/renderers/blocks/FunctionContainerRenderer.d.ts.map +0 -1
- package/dist/renderers/blocks/FunctionContainerRenderer.js +0 -49
- package/dist/renderers/blocks/FunctionHeaderGeometry.d.ts +0 -20
- package/dist/renderers/blocks/FunctionHeaderGeometry.d.ts.map +0 -1
- package/dist/renderers/blocks/FunctionHeaderGeometry.js +0 -35
- package/dist/renderers/blocks/FunctionHeaderProps.d.ts +0 -7
- package/dist/renderers/blocks/FunctionHeaderProps.d.ts.map +0 -1
- package/dist/renderers/blocks/FunctionHeaderProps.js +0 -1
- package/dist/renderers/blocks/FunctionHeaderRenderer.d.ts +0 -11
- package/dist/renderers/blocks/FunctionHeaderRenderer.d.ts.map +0 -1
- package/dist/renderers/blocks/FunctionHeaderRenderer.js +0 -36
- package/dist/renderers/blocks/IfBlockGeometry.d.ts +0 -42
- package/dist/renderers/blocks/IfBlockGeometry.d.ts.map +0 -1
- package/dist/renderers/blocks/IfBlockGeometry.js +0 -83
- package/dist/renderers/blocks/IfRenderer.d.ts +0 -10
- package/dist/renderers/blocks/IfRenderer.d.ts.map +0 -1
- package/dist/renderers/blocks/IfRenderer.js +0 -69
- package/dist/renderers/blocks/IfRendererProps.d.ts +0 -7
- package/dist/renderers/blocks/IfRendererProps.d.ts.map +0 -1
- package/dist/renderers/blocks/IfRendererProps.js +0 -1
- package/dist/renderers/blocks/LoopRenderer.d.ts +0 -12
- package/dist/renderers/blocks/LoopRenderer.d.ts.map +0 -1
- package/dist/renderers/blocks/LoopRenderer.js +0 -37
- package/dist/renderers/blocks/LoopRendererProps.d.ts +0 -8
- package/dist/renderers/blocks/LoopRendererProps.d.ts.map +0 -1
- package/dist/renderers/blocks/LoopRendererProps.js +0 -1
- package/dist/renderers/blocks/Point.d.ts +0 -2
- package/dist/renderers/blocks/Point.d.ts.map +0 -1
- package/dist/renderers/blocks/Point.js +0 -1
- package/dist/renderers/blocks/StartBlockGeometry.d.ts +0 -38
- package/dist/renderers/blocks/StartBlockGeometry.d.ts.map +0 -1
- package/dist/renderers/blocks/StartBlockGeometry.js +0 -56
- package/dist/renderers/blocks/StartRenderer.d.ts +0 -10
- package/dist/renderers/blocks/StartRenderer.d.ts.map +0 -1
- package/dist/renderers/blocks/StartRenderer.js +0 -39
- package/dist/renderers/blocks/StartRendererProps.d.ts +0 -6
- package/dist/renderers/blocks/StartRendererProps.d.ts.map +0 -1
- package/dist/renderers/blocks/StartRendererProps.js +0 -1
- package/dist/utils/layout.d.ts +0 -14
- package/dist/utils/layout.d.ts.map +0 -1
- package/dist/utils/layout.js +0 -186
- package/src/renderers/D3PadRenderer.tsx +0 -145
- package/src/renderers/PadNodeRenderer.ts +0 -517
- package/src/renderers/blocks/EndBlockGeometry.ts +0 -52
- package/src/renderers/blocks/EndRenderer.tsx +0 -48
- package/src/renderers/blocks/EndRendererProps.ts +0 -5
- package/src/renderers/blocks/FunctionContainerGeometry.ts +0 -54
- package/src/renderers/blocks/FunctionContainerRenderer.tsx +0 -62
- package/src/renderers/blocks/FunctionHeaderGeometry.ts +0 -43
- package/src/renderers/blocks/FunctionHeaderProps.ts +0 -6
- package/src/renderers/blocks/FunctionHeaderRenderer.tsx +0 -47
- package/src/renderers/blocks/IfBlockGeometry.ts +0 -98
- package/src/renderers/blocks/IfRenderer.tsx +0 -88
- package/src/renderers/blocks/IfRendererProps.ts +0 -7
- package/src/renderers/blocks/LoopRenderer.tsx +0 -50
- package/src/renderers/blocks/LoopRendererProps.ts +0 -7
- package/src/renderers/blocks/Point.ts +0 -4
- package/src/renderers/blocks/README.md +0 -29
- package/src/renderers/blocks/StartBlockGeometry.ts +0 -66
- package/src/renderers/blocks/StartRenderer.tsx +0 -49
- package/src/renderers/blocks/StartRendererProps.ts +0 -5
- package/src/utils/layout.ts +0 -247
package/src/utils/layout.ts
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import type { PadNode } from '@yanqirenshi/model.pad'; // 型は model.pad に移した(#201)
|
|
2
|
-
|
|
3
|
-
export interface LayoutNode {
|
|
4
|
-
id: string; // 一意のID(D3データ結合用)
|
|
5
|
-
padNode: PadNode;
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
children: LayoutNode[];
|
|
11
|
-
// Extra data for drawing
|
|
12
|
-
label?: string;
|
|
13
|
-
condition?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const CONFIG = {
|
|
17
|
-
MIN_WIDTH: 100,
|
|
18
|
-
MIN_HEIGHT: 40,
|
|
19
|
-
BLOCK_PADDING: 10,
|
|
20
|
-
FONT_SIZE: 14,
|
|
21
|
-
CHAR_WIDTH: 8, // Approx
|
|
22
|
-
IF_CONDITION_WIDTH: 30, // The small wedge/box on left
|
|
23
|
-
MARGIN_Y: 20, // Vertical spacing between blocks
|
|
24
|
-
GAP_X: 20, // Horizontal gap between condition and body
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// ID生成用のカウンター
|
|
28
|
-
let idCounter = 0;
|
|
29
|
-
|
|
30
|
-
function generateId(prefix: string): string {
|
|
31
|
-
return `${prefix}-${idCounter++}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// ID カウンターをリセット(新しいレイアウト計算開始時)
|
|
35
|
-
function resetIdCounter(): void {
|
|
36
|
-
idCounter = 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function calculateLayout(node: PadNode): LayoutNode {
|
|
40
|
-
resetIdCounter();
|
|
41
|
-
return calculateLayoutInternal(node, 'root');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function calculateLayoutInternal(node: PadNode, parentPath: string): LayoutNode {
|
|
45
|
-
switch (node.type) {
|
|
46
|
-
case 'sequence':
|
|
47
|
-
return layoutSequence(node.children, parentPath);
|
|
48
|
-
case 'block':
|
|
49
|
-
return layoutBlock(node.label, node.children, parentPath);
|
|
50
|
-
case 'command':
|
|
51
|
-
return layoutCommand(node.label, parentPath);
|
|
52
|
-
case 'if':
|
|
53
|
-
const ifChildren = [node.then_block];
|
|
54
|
-
if (node.else_block) ifChildren.push(node.else_block);
|
|
55
|
-
return layoutIf(node.condition, ifChildren, parentPath);
|
|
56
|
-
case 'loop':
|
|
57
|
-
return layoutLoop(node.condition, node.body, parentPath);
|
|
58
|
-
default:
|
|
59
|
-
return {
|
|
60
|
-
id: generateId(parentPath),
|
|
61
|
-
padNode: node, x: 0, y: 0, width: CONFIG.MIN_WIDTH, height: CONFIG.MIN_HEIGHT, children: []
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
import { StartBlockGeometry } from '../renderers/blocks/StartBlockGeometry';
|
|
67
|
-
import { FunctionContainerGeometry } from '../renderers/blocks/FunctionContainerGeometry';
|
|
68
|
-
|
|
69
|
-
function layoutSequence(nodes: PadNode[], parentPath: string): LayoutNode {
|
|
70
|
-
const id = generateId(`${parentPath}-seq`);
|
|
71
|
-
const childrenLayouts = nodes.map((node, index) =>
|
|
72
|
-
calculateLayoutInternal(node, `${id}-${index}`)
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
let currentY = 0;
|
|
76
|
-
let maxWidth = CONFIG.MIN_WIDTH;
|
|
77
|
-
|
|
78
|
-
childrenLayouts.forEach((child, index) => {
|
|
79
|
-
child.y = currentY;
|
|
80
|
-
currentY += child.height;
|
|
81
|
-
|
|
82
|
-
if (index < childrenLayouts.length - 1) {
|
|
83
|
-
currentY += CONFIG.MARGIN_Y;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
maxWidth = Math.max(maxWidth, child.width);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
id,
|
|
91
|
-
padNode: { type: 'sequence', children: nodes },
|
|
92
|
-
x: 0,
|
|
93
|
-
y: 0,
|
|
94
|
-
width: maxWidth,
|
|
95
|
-
height: currentY,
|
|
96
|
-
children: childrenLayouts
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function layoutBlock(label: string, children: PadNode[], parentPath: string): LayoutNode {
|
|
101
|
-
const id = generateId(`${parentPath}-block`);
|
|
102
|
-
const seqLayout = layoutSequence(children, id);
|
|
103
|
-
|
|
104
|
-
const startNodeWidth = StartBlockGeometry.calculateWidth("START");
|
|
105
|
-
const startNodeHeight = 30;
|
|
106
|
-
const endNodeHeight = 30;
|
|
107
|
-
|
|
108
|
-
const centerLineX = startNodeWidth / 2;
|
|
109
|
-
const graphWidth = Math.max(seqLayout.width + centerLineX, startNodeWidth);
|
|
110
|
-
|
|
111
|
-
const paddingTop = startNodeHeight + CONFIG.MARGIN_Y;
|
|
112
|
-
const paddingBottom = CONFIG.MARGIN_Y;
|
|
113
|
-
const graphHeight = paddingTop + seqLayout.height + paddingBottom + endNodeHeight;
|
|
114
|
-
|
|
115
|
-
const containerPadding = FunctionContainerGeometry.PADDING;
|
|
116
|
-
const headerHeight = FunctionContainerGeometry.HEADER_HEIGHT;
|
|
117
|
-
|
|
118
|
-
const containerWidth = graphWidth + containerPadding * 2;
|
|
119
|
-
const containerHeight = headerHeight + graphHeight + containerPadding * 2;
|
|
120
|
-
|
|
121
|
-
seqLayout.x = containerPadding + centerLineX;
|
|
122
|
-
|
|
123
|
-
const contentStartY = headerHeight + containerPadding;
|
|
124
|
-
seqLayout.y = contentStartY + paddingTop;
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
id,
|
|
128
|
-
padNode: { type: 'block', label, children },
|
|
129
|
-
x: 0,
|
|
130
|
-
y: 0,
|
|
131
|
-
width: containerWidth,
|
|
132
|
-
height: containerHeight,
|
|
133
|
-
children: [seqLayout],
|
|
134
|
-
label
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function layoutCommand(label: string, parentPath: string): LayoutNode {
|
|
139
|
-
const id = generateId(`${parentPath}-cmd`);
|
|
140
|
-
|
|
141
|
-
const canvas = document.createElement('canvas');
|
|
142
|
-
const context = canvas.getContext('2d')!;
|
|
143
|
-
context.font = '14px monospace';
|
|
144
|
-
const textMetrics = context.measureText(label);
|
|
145
|
-
|
|
146
|
-
const textWidth = textMetrics.width + 20;
|
|
147
|
-
const width = Math.max(CONFIG.MIN_WIDTH, textWidth);
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
id,
|
|
151
|
-
padNode: { type: 'command', label },
|
|
152
|
-
x: 0,
|
|
153
|
-
y: 0,
|
|
154
|
-
width: width,
|
|
155
|
-
height: CONFIG.MIN_HEIGHT,
|
|
156
|
-
children: [],
|
|
157
|
-
label
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function layoutIf(condition: string, children: PadNode[], parentPath: string): LayoutNode {
|
|
162
|
-
const id = generateId(`${parentPath}-if`);
|
|
163
|
-
|
|
164
|
-
const thenLayout = calculateLayoutInternal(children[0], `${id}-then`);
|
|
165
|
-
const elseLayout = children.length > 1 ? calculateLayoutInternal(children[1], `${id}-else`) : null;
|
|
166
|
-
|
|
167
|
-
const canvas = document.createElement('canvas');
|
|
168
|
-
const context = canvas.getContext('2d')!;
|
|
169
|
-
context.font = '14px monospace';
|
|
170
|
-
const labelWidth = Math.max(context.measureText(condition).width, 40) + 60;
|
|
171
|
-
|
|
172
|
-
const childX = labelWidth;
|
|
173
|
-
|
|
174
|
-
thenLayout.y = 0;
|
|
175
|
-
thenLayout.x = childX;
|
|
176
|
-
|
|
177
|
-
const thenHalf = thenLayout.height / 2;
|
|
178
|
-
const topVertexY = thenHalf;
|
|
179
|
-
|
|
180
|
-
let height = 0;
|
|
181
|
-
const gap = 40;
|
|
182
|
-
const minWedgeHeight = 60;
|
|
183
|
-
|
|
184
|
-
if (elseLayout) {
|
|
185
|
-
const elseHalf = elseLayout.height / 2;
|
|
186
|
-
|
|
187
|
-
const minBotVertexY_for_spacing = thenLayout.height + gap + elseHalf;
|
|
188
|
-
const minBotVertexY_for_wedge = topVertexY + minWedgeHeight;
|
|
189
|
-
|
|
190
|
-
const botVertexY = Math.max(minBotVertexY_for_spacing, minBotVertexY_for_wedge);
|
|
191
|
-
|
|
192
|
-
elseLayout.y = botVertexY - elseHalf;
|
|
193
|
-
elseLayout.x = childX;
|
|
194
|
-
|
|
195
|
-
height = elseLayout.y + elseLayout.height;
|
|
196
|
-
} else {
|
|
197
|
-
height = Math.max(thenLayout.height, topVertexY + minWedgeHeight);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const width = childX + Math.max(thenLayout.width, elseLayout ? elseLayout.width : 0) + 50;
|
|
201
|
-
const totalHeight = height + 20;
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
id,
|
|
205
|
-
padNode: { type: 'if', condition, then_block: children[0], else_block: children.length > 1 ? children[1] : undefined },
|
|
206
|
-
x: 0,
|
|
207
|
-
y: 0,
|
|
208
|
-
width,
|
|
209
|
-
height: totalHeight,
|
|
210
|
-
children: elseLayout ? [thenLayout, elseLayout] : [thenLayout],
|
|
211
|
-
label: condition,
|
|
212
|
-
condition
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function layoutLoop(condition: string, body: PadNode, parentPath: string): LayoutNode {
|
|
217
|
-
const id = generateId(`${parentPath}-loop`);
|
|
218
|
-
const bodyLayout = calculateLayoutInternal(body, `${id}-body`);
|
|
219
|
-
|
|
220
|
-
const canvas = document.createElement('canvas');
|
|
221
|
-
const context = canvas.getContext('2d')!;
|
|
222
|
-
context.font = '14px monospace';
|
|
223
|
-
const textMetrics = context.measureText(condition);
|
|
224
|
-
|
|
225
|
-
const doubleLineWidth = 10;
|
|
226
|
-
const textPadding = 40;
|
|
227
|
-
const conditionBoxWidth = doubleLineWidth + textMetrics.width + textPadding;
|
|
228
|
-
|
|
229
|
-
const boxWidth = Math.max(CONFIG.MIN_WIDTH, conditionBoxWidth);
|
|
230
|
-
|
|
231
|
-
bodyLayout.x = boxWidth + CONFIG.GAP_X;
|
|
232
|
-
bodyLayout.y = 0;
|
|
233
|
-
|
|
234
|
-
const width = boxWidth + CONFIG.GAP_X + bodyLayout.width;
|
|
235
|
-
const height = Math.max(CONFIG.MIN_HEIGHT, bodyLayout.height);
|
|
236
|
-
|
|
237
|
-
return {
|
|
238
|
-
id,
|
|
239
|
-
padNode: { type: 'loop', condition, body },
|
|
240
|
-
x: 0,
|
|
241
|
-
y: 0,
|
|
242
|
-
width,
|
|
243
|
-
height,
|
|
244
|
-
children: [bodyLayout],
|
|
245
|
-
condition
|
|
246
|
-
}
|
|
247
|
-
}
|