bpmn-elk-layout 1.0.0 → 1.0.2
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 +164 -0
- package/dist/bin/bpmn-elk-layout.js +5487 -5167
- package/dist/bin/bpmn-elk-layout.js.map +1 -1
- package/dist/index.js +48 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -41
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.js +48 -41
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +48 -41
- package/dist/index.node.mjs.map +1 -1
- package/package.json +17 -5
package/dist/index.node.js
CHANGED
|
@@ -304,6 +304,11 @@ function lineIntersection(p1, p2, p3, p4) {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
// src/utils/debug.ts
|
|
307
|
+
var cliMode = false;
|
|
308
|
+
function isDebugEnabled() {
|
|
309
|
+
if (cliMode) return false;
|
|
310
|
+
return typeof process !== "undefined" && process.env?.["DEBUG"] === "true";
|
|
311
|
+
}
|
|
307
312
|
var DEBUG = typeof process !== "undefined" && process.env?.["DEBUG"] === "true";
|
|
308
313
|
|
|
309
314
|
// src/layout/edge-routing/edge-fixer.ts
|
|
@@ -337,7 +342,7 @@ var EdgeFixer = class {
|
|
|
337
342
|
const isFlowNode = flowNodePatterns.some((pattern) => pattern.test(id));
|
|
338
343
|
const isPool = poolPatterns.some((pattern) => pattern.test(id));
|
|
339
344
|
const bpmn = node.bpmn;
|
|
340
|
-
if (
|
|
345
|
+
if (isDebugEnabled() && (id.includes("lane") || id.includes("pool") || id.includes("end_fast") || id.includes("gateway_fast"))) {
|
|
341
346
|
console.log(`[BPMN] EdgeFixer.collectNodePositions: id=${id}, offsetX=${offsetX}, offsetY=${offsetY}, bpmn=${JSON.stringify(bpmn)}`);
|
|
342
347
|
console.log(`[BPMN] node.x=${node.x}, node.y=${node.y}, isFlowNode=${isFlowNode}, isPool=${isPool}`);
|
|
343
348
|
}
|
|
@@ -426,7 +431,7 @@ var EdgeFixer = class {
|
|
|
426
431
|
}
|
|
427
432
|
const targetPos = targetId ? nodePositions.get(targetId) : void 0;
|
|
428
433
|
const sourcePos = sourceId ? nodePositions.get(sourceId) : void 0;
|
|
429
|
-
if (
|
|
434
|
+
if (isDebugEnabled() && edge.id?.includes("back")) {
|
|
430
435
|
console.log(`[BPMN] Edge ${edge.id}: sourceId=${sourceId}, targetId=${targetId}`);
|
|
431
436
|
console.log(`[BPMN] Edge ${edge.id}: sourcePos=${JSON.stringify(sourcePos)}, targetPos=${JSON.stringify(targetPos)}`);
|
|
432
437
|
console.log(`[BPMN] Edge ${edge.id}: waypoints.length=${waypoints.length}`);
|
|
@@ -435,7 +440,7 @@ var EdgeFixer = class {
|
|
|
435
440
|
const lastWaypoint = waypoints[waypoints.length - 1];
|
|
436
441
|
const secondLastWaypoint = waypoints[waypoints.length - 2];
|
|
437
442
|
const isReturnEdge2 = targetPos.y + targetPos.height < sourcePos.y;
|
|
438
|
-
if (
|
|
443
|
+
if (isDebugEnabled() && edge.id?.includes("back")) {
|
|
439
444
|
console.log(`[BPMN] Edge ${edge.id}: isReturnEdge=${isReturnEdge2}`);
|
|
440
445
|
if (lastWaypoint) {
|
|
441
446
|
console.log(`[BPMN] Edge ${edge.id}: lastWaypoint=(${lastWaypoint.x},${lastWaypoint.y})`);
|
|
@@ -455,7 +460,7 @@ var EdgeFixer = class {
|
|
|
455
460
|
}
|
|
456
461
|
}
|
|
457
462
|
if (crossedNodes.length === 0) return;
|
|
458
|
-
if (
|
|
463
|
+
if (isDebugEnabled()) {
|
|
459
464
|
console.log(`[BPMN] Edge ${edge.id} crosses nodes: ${crossedNodes.join(", ")}`);
|
|
460
465
|
}
|
|
461
466
|
if (!sourcePos || !targetPos) return;
|
|
@@ -506,7 +511,7 @@ var EdgeFixer = class {
|
|
|
506
511
|
y: bp.y - containerOffsetY
|
|
507
512
|
}));
|
|
508
513
|
section.bendPoints = relativeBendPoints.length > 0 ? relativeBendPoints : void 0;
|
|
509
|
-
if (
|
|
514
|
+
if (isDebugEnabled()) {
|
|
510
515
|
console.log(`[BPMN] Fixed edge ${edge.id} with ${relativeBendPoints.length} bend points`);
|
|
511
516
|
}
|
|
512
517
|
}
|
|
@@ -1296,7 +1301,8 @@ function applyNodeMoves(graph, movedNodes) {
|
|
|
1296
1301
|
}
|
|
1297
1302
|
|
|
1298
1303
|
// src/layout/post-processing/boundary-event/edge-recalculator.ts
|
|
1299
|
-
function recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo
|
|
1304
|
+
function recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo) {
|
|
1305
|
+
const debug = isDebugEnabled();
|
|
1300
1306
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
1301
1307
|
const buildNodeMap2 = (node) => {
|
|
1302
1308
|
nodeMap.set(node.id, node);
|
|
@@ -1373,7 +1379,8 @@ function recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo, deb
|
|
|
1373
1379
|
};
|
|
1374
1380
|
processEdges(graph);
|
|
1375
1381
|
}
|
|
1376
|
-
function recalculateEdgeWithObstacleAvoidance(edge, source, target, obstacleIds, nodeMap
|
|
1382
|
+
function recalculateEdgeWithObstacleAvoidance(edge, source, target, obstacleIds, nodeMap) {
|
|
1383
|
+
const debug = isDebugEnabled();
|
|
1377
1384
|
const sx = source.x ?? 0;
|
|
1378
1385
|
const sy = source.y ?? 0;
|
|
1379
1386
|
const sw = source.width ?? 100;
|
|
@@ -1594,8 +1601,8 @@ var BoundaryEventHandler = class {
|
|
|
1594
1601
|
/**
|
|
1595
1602
|
* Recalculate edge waypoints for edges connected to moved nodes
|
|
1596
1603
|
*/
|
|
1597
|
-
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo
|
|
1598
|
-
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo
|
|
1604
|
+
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo) {
|
|
1605
|
+
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo);
|
|
1599
1606
|
}
|
|
1600
1607
|
};
|
|
1601
1608
|
|
|
@@ -2482,7 +2489,7 @@ var LaneArranger = class {
|
|
|
2482
2489
|
const targetId = edge.targets?.[0];
|
|
2483
2490
|
const sourcePos = sourceId ? nodePositions.get(sourceId) : void 0;
|
|
2484
2491
|
const targetPos = targetId ? nodePositions.get(targetId) : void 0;
|
|
2485
|
-
if (
|
|
2492
|
+
if (isDebugEnabled()) {
|
|
2486
2493
|
console.log(`[BPMN] recalculatePoolEdges ${edge.id}: source=${sourceId}, target=${targetId}`);
|
|
2487
2494
|
console.log(`[BPMN] sourcePos=${JSON.stringify(sourcePos)}`);
|
|
2488
2495
|
console.log(`[BPMN] targetPos=${JSON.stringify(targetPos)}`);
|
|
@@ -2492,7 +2499,7 @@ var LaneArranger = class {
|
|
|
2492
2499
|
const startY = sourcePos.y + sourcePos.height / 2;
|
|
2493
2500
|
const endX = targetPos.x;
|
|
2494
2501
|
const endY = targetPos.y + targetPos.height / 2;
|
|
2495
|
-
if (
|
|
2502
|
+
if (isDebugEnabled()) {
|
|
2496
2503
|
console.log(`[BPMN] startX=${startX}, startY=${startY}, endX=${endX}, endY=${endY}`);
|
|
2497
2504
|
}
|
|
2498
2505
|
const waypoints = [];
|
|
@@ -2503,7 +2510,7 @@ var LaneArranger = class {
|
|
|
2503
2510
|
waypoints.push({ x: midX, y: endY });
|
|
2504
2511
|
}
|
|
2505
2512
|
waypoints.push({ x: endX, y: endY });
|
|
2506
|
-
if (
|
|
2513
|
+
if (isDebugEnabled()) {
|
|
2507
2514
|
console.log(`[BPMN] waypoints=${JSON.stringify(waypoints)}`);
|
|
2508
2515
|
}
|
|
2509
2516
|
edge._poolRelativeCoords = true;
|
|
@@ -3011,7 +3018,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3011
3018
|
const gateways = /* @__PURE__ */ new Map();
|
|
3012
3019
|
this.collectGateways(layoutedGraph, originalGraph, gateways, 0, 0);
|
|
3013
3020
|
if (gateways.size === 0) return;
|
|
3014
|
-
if (
|
|
3021
|
+
if (isDebugEnabled()) {
|
|
3015
3022
|
console.log(`[BPMN] GatewayEdgeAdjuster: Found ${gateways.size} gateways`);
|
|
3016
3023
|
for (const [id, info] of gateways) {
|
|
3017
3024
|
console.log(`[BPMN] - ${id}: bounds=(${info.bounds.x},${info.bounds.y},${info.bounds.width},${info.bounds.height})`);
|
|
@@ -3098,7 +3105,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3098
3105
|
const section = edge.sections[0];
|
|
3099
3106
|
const sourceId = edge.sources?.[0];
|
|
3100
3107
|
const targetId = edge.targets?.[0];
|
|
3101
|
-
if (
|
|
3108
|
+
if (isDebugEnabled()) {
|
|
3102
3109
|
console.log(`[BPMN] GatewayEdgeAdjuster: Processing edge ${edge.id}, offset=(${offsetX},${offsetY})`);
|
|
3103
3110
|
console.log(`[BPMN] sourceId=${sourceId}, targetId=${targetId}`);
|
|
3104
3111
|
console.log(`[BPMN] startPoint=(${section.startPoint.x},${section.startPoint.y}), endPoint=(${section.endPoint.x},${section.endPoint.y})`);
|
|
@@ -3110,7 +3117,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3110
3117
|
}
|
|
3111
3118
|
const targetGateway = targetId ? gateways.get(targetId) : void 0;
|
|
3112
3119
|
if (targetGateway) {
|
|
3113
|
-
if (
|
|
3120
|
+
if (isDebugEnabled()) {
|
|
3114
3121
|
console.log(`[BPMN] target gateway: ${targetId}, bounds=(${targetGateway.bounds.x},${targetGateway.bounds.y})`);
|
|
3115
3122
|
console.log(`[BPMN] left corner: (${targetGateway.corners.left.x},${targetGateway.corners.left.y})`);
|
|
3116
3123
|
}
|
|
@@ -3181,7 +3188,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3181
3188
|
lastBend.x = newEnd.x;
|
|
3182
3189
|
}
|
|
3183
3190
|
}
|
|
3184
|
-
if (
|
|
3191
|
+
if (isDebugEnabled()) {
|
|
3185
3192
|
console.log(`[BPMN] GatewayEdgeAdjuster: Adjusted edge ${edge.id} endpoint from (${endX},${endY}) to (${targetCorner.x},${targetCorner.y})`);
|
|
3186
3193
|
}
|
|
3187
3194
|
} else {
|
|
@@ -3195,7 +3202,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3195
3202
|
x: intersectionPoint.x - offsetX,
|
|
3196
3203
|
y: intersectionPoint.y - offsetY
|
|
3197
3204
|
};
|
|
3198
|
-
if (
|
|
3205
|
+
if (isDebugEnabled()) {
|
|
3199
3206
|
console.log(`[BPMN] GatewayEdgeAdjuster: Adjusted edge ${edge.id} endpoint to diamond intersection (${intersectionPoint.x},${intersectionPoint.y})`);
|
|
3200
3207
|
}
|
|
3201
3208
|
}
|
|
@@ -3455,7 +3462,7 @@ var ElkGraphPreparer = class {
|
|
|
3455
3462
|
for (const startId of startEvents) {
|
|
3456
3463
|
traverseMainFlow(startId);
|
|
3457
3464
|
}
|
|
3458
|
-
if (
|
|
3465
|
+
if (isDebugEnabled()) {
|
|
3459
3466
|
console.log(`[BPMN] Main flow nodes: ${Array.from(mainFlowNodes).join(", ")}`);
|
|
3460
3467
|
}
|
|
3461
3468
|
return mainFlowNodes;
|
|
@@ -3790,7 +3797,7 @@ var ResultMerger = class {
|
|
|
3790
3797
|
return originalEdges.map((origEdge) => {
|
|
3791
3798
|
const layoutedEdge = layoutedEdgeMap.get(origEdge.id);
|
|
3792
3799
|
if (layoutedEdge) {
|
|
3793
|
-
if (
|
|
3800
|
+
if (isDebugEnabled() && layoutedEdge.sections?.[0]?.bendPoints?.length) {
|
|
3794
3801
|
console.log(`[BPMN] Merge ${origEdge.id}: bendPoints=${JSON.stringify(layoutedEdge.sections[0].bendPoints)}`);
|
|
3795
3802
|
}
|
|
3796
3803
|
const mergedEdge = {
|
|
@@ -3928,7 +3935,7 @@ var MainFlowNormalizer = class {
|
|
|
3928
3935
|
return;
|
|
3929
3936
|
}
|
|
3930
3937
|
const offsetY = currentMinY - TARGET_MAIN_FLOW_Y;
|
|
3931
|
-
if (
|
|
3938
|
+
if (isDebugEnabled()) {
|
|
3932
3939
|
console.log(`[BPMN] Normalizing main flow: currentMinY=${currentMinY}, offsetY=${offsetY}`);
|
|
3933
3940
|
console.log(`[BPMN] Upstream nodes: ${upstreamMainFlow.map((n) => n.id).join(", ")}`);
|
|
3934
3941
|
console.log(`[BPMN] Downstream nodes: ${downstreamMainFlow.map((n) => n.id).join(", ")}`);
|
|
@@ -3936,7 +3943,7 @@ var MainFlowNormalizer = class {
|
|
|
3936
3943
|
for (const node of otherUpstreamNodes) {
|
|
3937
3944
|
if (node.y !== void 0) {
|
|
3938
3945
|
node.y -= offsetY;
|
|
3939
|
-
if (
|
|
3946
|
+
if (isDebugEnabled()) {
|
|
3940
3947
|
console.log(`[BPMN] Shifted upstream ${node.id} to y=${node.y}`);
|
|
3941
3948
|
}
|
|
3942
3949
|
}
|
|
@@ -3949,14 +3956,14 @@ var MainFlowNormalizer = class {
|
|
|
3949
3956
|
const predecessorCenterY = predecessor.y + (predecessor.height ?? 80) / 2;
|
|
3950
3957
|
const endNodeCenterY = (endNode.height ?? 36) / 2;
|
|
3951
3958
|
endNode.y = predecessorCenterY - endNodeCenterY;
|
|
3952
|
-
if (
|
|
3959
|
+
if (isDebugEnabled()) {
|
|
3953
3960
|
console.log(`[BPMN] Aligned endEvent ${endNode.id} with predecessor ${predecessorId}: y=${endNode.y}`);
|
|
3954
3961
|
}
|
|
3955
3962
|
}
|
|
3956
3963
|
} else {
|
|
3957
3964
|
if (endNode.y !== void 0) {
|
|
3958
3965
|
endNode.y -= offsetY;
|
|
3959
|
-
if (
|
|
3966
|
+
if (isDebugEnabled()) {
|
|
3960
3967
|
console.log(`[BPMN] Shifted upstream ${endNode.id} to y=${endNode.y} (no predecessor found)`);
|
|
3961
3968
|
}
|
|
3962
3969
|
}
|
|
@@ -3984,7 +3991,7 @@ var MainFlowNormalizer = class {
|
|
|
3984
3991
|
const newY = prevBottom + MIN_SPACING;
|
|
3985
3992
|
currNode.y = newY;
|
|
3986
3993
|
adjustedEndEvents.set(currNode.id, newY);
|
|
3987
|
-
if (
|
|
3994
|
+
if (isDebugEnabled()) {
|
|
3988
3995
|
console.log(`[BPMN] Adjusted overlapping endEvent ${currNode.id} at x=${x}: y=${currNode.y}`);
|
|
3989
3996
|
}
|
|
3990
3997
|
}
|
|
@@ -4008,7 +4015,7 @@ var MainFlowNormalizer = class {
|
|
|
4008
4015
|
for (const node of downstreamMainFlow) {
|
|
4009
4016
|
if (node.y !== void 0) {
|
|
4010
4017
|
node.y -= downstreamOffsetY;
|
|
4011
|
-
if (
|
|
4018
|
+
if (isDebugEnabled()) {
|
|
4012
4019
|
console.log(`[BPMN] Shifted downstream ${node.id} to y=${node.y}`);
|
|
4013
4020
|
}
|
|
4014
4021
|
}
|
|
@@ -4190,20 +4197,20 @@ var MainFlowNormalizer = class {
|
|
|
4190
4197
|
lastBend.y = newTargetY;
|
|
4191
4198
|
section.endPoint.y = newTargetY;
|
|
4192
4199
|
edgesWithAdjustedEndpoint.add(edge.id);
|
|
4193
|
-
if (
|
|
4200
|
+
if (isDebugEnabled()) {
|
|
4194
4201
|
console.log(`[BPMN] Updated edge ${edge.id} last bendPoint and endpoint to y=${newTargetY}`);
|
|
4195
4202
|
}
|
|
4196
4203
|
} else {
|
|
4197
4204
|
section.endPoint.y = newTargetY;
|
|
4198
4205
|
edgesWithAdjustedEndpoint.add(edge.id);
|
|
4199
|
-
if (
|
|
4206
|
+
if (isDebugEnabled()) {
|
|
4200
4207
|
console.log(`[BPMN] Updated edge ${edge.id} endpoint to y=${newTargetY}`);
|
|
4201
4208
|
}
|
|
4202
4209
|
}
|
|
4203
4210
|
} else if (section.endPoint) {
|
|
4204
4211
|
section.endPoint.y = newTargetY;
|
|
4205
4212
|
edgesWithAdjustedEndpoint.add(edge.id);
|
|
4206
|
-
if (
|
|
4213
|
+
if (isDebugEnabled()) {
|
|
4207
4214
|
console.log(`[BPMN] Updated edge ${edge.id} endpoint to y=${newTargetY}`);
|
|
4208
4215
|
}
|
|
4209
4216
|
}
|
|
@@ -4317,7 +4324,7 @@ var GatewayPropagator = class {
|
|
|
4317
4324
|
offset: 0,
|
|
4318
4325
|
newX
|
|
4319
4326
|
});
|
|
4320
|
-
if (
|
|
4327
|
+
if (isDebugEnabled()) {
|
|
4321
4328
|
console.log(`[BPMN] Propagating gateway movement to ${targetId}: x ${currentX} -> ${newX}`);
|
|
4322
4329
|
}
|
|
4323
4330
|
this.propagateDownstreamX(targetId, newX, targetNode.width ?? 100, nodeMap, edgeMap, mainFlowNodes, gatewayMoves);
|
|
@@ -4345,7 +4352,7 @@ var GatewayPropagator = class {
|
|
|
4345
4352
|
offset: 0,
|
|
4346
4353
|
newX
|
|
4347
4354
|
});
|
|
4348
|
-
if (
|
|
4355
|
+
if (isDebugEnabled()) {
|
|
4349
4356
|
console.log(`[BPMN] Propagating X to ${targetId}: x ${currentX} -> ${newX}`);
|
|
4350
4357
|
}
|
|
4351
4358
|
this.propagateDownstreamX(targetId, newX, targetNode.width ?? 100, nodeMap, edgeMap, mainFlowNodes, moves);
|
|
@@ -4400,14 +4407,14 @@ var ElkLayouter = class {
|
|
|
4400
4407
|
const layoutedElkGraph = await this.elk.layout(elkGraph);
|
|
4401
4408
|
const mainFlowNodes = this.graphPreparer.identifyMainFlowNodes(sizedGraph, boundaryEventTargetIds);
|
|
4402
4409
|
this.mainFlowNormalizer.normalize(layoutedElkGraph, mainFlowNodes, boundaryEventTargetIds, sizedGraph);
|
|
4403
|
-
const movedNodes = this.boundaryEventHandler.identifyNodesToMove(layoutedElkGraph, boundaryEventInfo, sizedGraph,
|
|
4410
|
+
const movedNodes = this.boundaryEventHandler.identifyNodesToMove(layoutedElkGraph, boundaryEventInfo, sizedGraph, isDebugEnabled());
|
|
4404
4411
|
if (movedNodes.size > 0) {
|
|
4405
4412
|
this.boundaryEventHandler.applyNodeMoves(layoutedElkGraph, movedNodes);
|
|
4406
4413
|
const gatewayMoves = this.boundaryEventHandler.repositionConvergingGateways(
|
|
4407
4414
|
layoutedElkGraph,
|
|
4408
4415
|
movedNodes,
|
|
4409
4416
|
boundaryEventInfo,
|
|
4410
|
-
|
|
4417
|
+
isDebugEnabled()
|
|
4411
4418
|
);
|
|
4412
4419
|
if (gatewayMoves.size > 0) {
|
|
4413
4420
|
this.boundaryEventHandler.applyNodeMoves(layoutedElkGraph, gatewayMoves);
|
|
@@ -4416,7 +4423,7 @@ var ElkLayouter = class {
|
|
|
4416
4423
|
for (const [id, move] of gatewayMoves) {
|
|
4417
4424
|
movedNodes.set(id, move);
|
|
4418
4425
|
}
|
|
4419
|
-
this.boundaryEventHandler.recalculateEdgesForMovedNodes(layoutedElkGraph, movedNodes, boundaryEventInfo
|
|
4426
|
+
this.boundaryEventHandler.recalculateEdgesForMovedNodes(layoutedElkGraph, movedNodes, boundaryEventInfo);
|
|
4420
4427
|
}
|
|
4421
4428
|
this.artifactPositioner.reposition(layoutedElkGraph, artifactInfo);
|
|
4422
4429
|
this.laneArranger.rearrange(layoutedElkGraph, sizedGraph);
|
|
@@ -4690,7 +4697,7 @@ function adjustGatewayEndpoint(endpoint, adjacentPoint, gatewayBounds, isSource)
|
|
|
4690
4697
|
const gatewayCenterX = gatewayBounds.x + gatewayBounds.width / 2;
|
|
4691
4698
|
const gatewayCenterY = gatewayBounds.y + gatewayBounds.height / 2;
|
|
4692
4699
|
const tolerance = 1;
|
|
4693
|
-
if (
|
|
4700
|
+
if (isDebugEnabled()) {
|
|
4694
4701
|
console.log(`[BPMN] adjustGatewayEndpoint: isSource=${isSource}`);
|
|
4695
4702
|
console.log(` endpoint: (${endpoint.x}, ${endpoint.y})`);
|
|
4696
4703
|
console.log(` gatewayBounds: x=${gatewayBounds.x}, y=${gatewayBounds.y}, w=${gatewayBounds.width}, h=${gatewayBounds.height}`);
|
|
@@ -4702,22 +4709,22 @@ function adjustGatewayEndpoint(endpoint, adjacentPoint, gatewayBounds, isSource)
|
|
|
4702
4709
|
const topCorner = { x: gatewayCenterX, y: gatewayBounds.y };
|
|
4703
4710
|
const bottomCorner = { x: gatewayCenterX, y: gatewayBounds.y + gatewayBounds.height };
|
|
4704
4711
|
if (Math.abs(endpoint.x - gatewayBounds.x) < tolerance && Math.abs(endpoint.y - gatewayCenterY) < tolerance) {
|
|
4705
|
-
if (
|
|
4712
|
+
if (isDebugEnabled()) console.log(` -> Already at LEFT corner, no adjustment`);
|
|
4706
4713
|
return endpoint;
|
|
4707
4714
|
}
|
|
4708
4715
|
if (Math.abs(endpoint.x - (gatewayBounds.x + gatewayBounds.width)) < tolerance && Math.abs(endpoint.y - gatewayCenterY) < tolerance) {
|
|
4709
|
-
if (
|
|
4716
|
+
if (isDebugEnabled()) console.log(` -> Already at RIGHT corner, no adjustment`);
|
|
4710
4717
|
return endpoint;
|
|
4711
4718
|
}
|
|
4712
4719
|
if (Math.abs(endpoint.y - gatewayBounds.y) < tolerance && Math.abs(endpoint.x - gatewayCenterX) < tolerance) {
|
|
4713
|
-
if (
|
|
4720
|
+
if (isDebugEnabled()) console.log(` -> Already at TOP corner, no adjustment`);
|
|
4714
4721
|
return endpoint;
|
|
4715
4722
|
}
|
|
4716
4723
|
if (Math.abs(endpoint.y - (gatewayBounds.y + gatewayBounds.height)) < tolerance && Math.abs(endpoint.x - gatewayCenterX) < tolerance) {
|
|
4717
|
-
if (
|
|
4724
|
+
if (isDebugEnabled()) console.log(` -> Already at BOTTOM corner, no adjustment`);
|
|
4718
4725
|
return endpoint;
|
|
4719
4726
|
}
|
|
4720
|
-
if (
|
|
4727
|
+
if (isDebugEnabled()) {
|
|
4721
4728
|
console.log(` -> NOT at corner, will adjust`);
|
|
4722
4729
|
}
|
|
4723
4730
|
const result = calculateDiamondIntersection(
|
|
@@ -4728,7 +4735,7 @@ function adjustGatewayEndpoint(endpoint, adjacentPoint, gatewayBounds, isSource)
|
|
|
4728
4735
|
isSource,
|
|
4729
4736
|
adjacentPoint
|
|
4730
4737
|
);
|
|
4731
|
-
if (
|
|
4738
|
+
if (isDebugEnabled()) {
|
|
4732
4739
|
console.log(` -> Adjusted to: (${result.x}, ${result.y})`);
|
|
4733
4740
|
}
|
|
4734
4741
|
return result;
|
|
@@ -5033,7 +5040,7 @@ var DiagramBuilder = class {
|
|
|
5033
5040
|
const targetIsGateway = this.isGatewayType(targetNode?.type);
|
|
5034
5041
|
let waypoints = [];
|
|
5035
5042
|
const hasPreCalculatedSections = edge.sections && edge.sections.length > 0 && edge.sections[0]?.bendPoints && edge.sections[0].bendPoints.length > 0;
|
|
5036
|
-
if (
|
|
5043
|
+
if (isDebugEnabled() && bePosition) {
|
|
5037
5044
|
console.log(`[BPMN] buildEdge ${edge.id}: preCalculated=${hasPreCalculatedSections}`);
|
|
5038
5045
|
}
|
|
5039
5046
|
if (bePosition && targetPosition && !hasPreCalculatedSections) {
|