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.mjs
CHANGED
|
@@ -249,6 +249,11 @@ function lineIntersection(p1, p2, p3, p4) {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
// src/utils/debug.ts
|
|
252
|
+
var cliMode = false;
|
|
253
|
+
function isDebugEnabled() {
|
|
254
|
+
if (cliMode) return false;
|
|
255
|
+
return typeof process !== "undefined" && process.env?.["DEBUG"] === "true";
|
|
256
|
+
}
|
|
252
257
|
var DEBUG = typeof process !== "undefined" && process.env?.["DEBUG"] === "true";
|
|
253
258
|
|
|
254
259
|
// src/layout/edge-routing/edge-fixer.ts
|
|
@@ -282,7 +287,7 @@ var EdgeFixer = class {
|
|
|
282
287
|
const isFlowNode = flowNodePatterns.some((pattern) => pattern.test(id));
|
|
283
288
|
const isPool = poolPatterns.some((pattern) => pattern.test(id));
|
|
284
289
|
const bpmn = node.bpmn;
|
|
285
|
-
if (
|
|
290
|
+
if (isDebugEnabled() && (id.includes("lane") || id.includes("pool") || id.includes("end_fast") || id.includes("gateway_fast"))) {
|
|
286
291
|
console.log(`[BPMN] EdgeFixer.collectNodePositions: id=${id}, offsetX=${offsetX}, offsetY=${offsetY}, bpmn=${JSON.stringify(bpmn)}`);
|
|
287
292
|
console.log(`[BPMN] node.x=${node.x}, node.y=${node.y}, isFlowNode=${isFlowNode}, isPool=${isPool}`);
|
|
288
293
|
}
|
|
@@ -371,7 +376,7 @@ var EdgeFixer = class {
|
|
|
371
376
|
}
|
|
372
377
|
const targetPos = targetId ? nodePositions.get(targetId) : void 0;
|
|
373
378
|
const sourcePos = sourceId ? nodePositions.get(sourceId) : void 0;
|
|
374
|
-
if (
|
|
379
|
+
if (isDebugEnabled() && edge.id?.includes("back")) {
|
|
375
380
|
console.log(`[BPMN] Edge ${edge.id}: sourceId=${sourceId}, targetId=${targetId}`);
|
|
376
381
|
console.log(`[BPMN] Edge ${edge.id}: sourcePos=${JSON.stringify(sourcePos)}, targetPos=${JSON.stringify(targetPos)}`);
|
|
377
382
|
console.log(`[BPMN] Edge ${edge.id}: waypoints.length=${waypoints.length}`);
|
|
@@ -380,7 +385,7 @@ var EdgeFixer = class {
|
|
|
380
385
|
const lastWaypoint = waypoints[waypoints.length - 1];
|
|
381
386
|
const secondLastWaypoint = waypoints[waypoints.length - 2];
|
|
382
387
|
const isReturnEdge2 = targetPos.y + targetPos.height < sourcePos.y;
|
|
383
|
-
if (
|
|
388
|
+
if (isDebugEnabled() && edge.id?.includes("back")) {
|
|
384
389
|
console.log(`[BPMN] Edge ${edge.id}: isReturnEdge=${isReturnEdge2}`);
|
|
385
390
|
if (lastWaypoint) {
|
|
386
391
|
console.log(`[BPMN] Edge ${edge.id}: lastWaypoint=(${lastWaypoint.x},${lastWaypoint.y})`);
|
|
@@ -400,7 +405,7 @@ var EdgeFixer = class {
|
|
|
400
405
|
}
|
|
401
406
|
}
|
|
402
407
|
if (crossedNodes.length === 0) return;
|
|
403
|
-
if (
|
|
408
|
+
if (isDebugEnabled()) {
|
|
404
409
|
console.log(`[BPMN] Edge ${edge.id} crosses nodes: ${crossedNodes.join(", ")}`);
|
|
405
410
|
}
|
|
406
411
|
if (!sourcePos || !targetPos) return;
|
|
@@ -451,7 +456,7 @@ var EdgeFixer = class {
|
|
|
451
456
|
y: bp.y - containerOffsetY
|
|
452
457
|
}));
|
|
453
458
|
section.bendPoints = relativeBendPoints.length > 0 ? relativeBendPoints : void 0;
|
|
454
|
-
if (
|
|
459
|
+
if (isDebugEnabled()) {
|
|
455
460
|
console.log(`[BPMN] Fixed edge ${edge.id} with ${relativeBendPoints.length} bend points`);
|
|
456
461
|
}
|
|
457
462
|
}
|
|
@@ -1241,7 +1246,8 @@ function applyNodeMoves(graph, movedNodes) {
|
|
|
1241
1246
|
}
|
|
1242
1247
|
|
|
1243
1248
|
// src/layout/post-processing/boundary-event/edge-recalculator.ts
|
|
1244
|
-
function recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo
|
|
1249
|
+
function recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo) {
|
|
1250
|
+
const debug = isDebugEnabled();
|
|
1245
1251
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
1246
1252
|
const buildNodeMap2 = (node) => {
|
|
1247
1253
|
nodeMap.set(node.id, node);
|
|
@@ -1318,7 +1324,8 @@ function recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo, deb
|
|
|
1318
1324
|
};
|
|
1319
1325
|
processEdges(graph);
|
|
1320
1326
|
}
|
|
1321
|
-
function recalculateEdgeWithObstacleAvoidance(edge, source, target, obstacleIds, nodeMap
|
|
1327
|
+
function recalculateEdgeWithObstacleAvoidance(edge, source, target, obstacleIds, nodeMap) {
|
|
1328
|
+
const debug = isDebugEnabled();
|
|
1322
1329
|
const sx = source.x ?? 0;
|
|
1323
1330
|
const sy = source.y ?? 0;
|
|
1324
1331
|
const sw = source.width ?? 100;
|
|
@@ -1539,8 +1546,8 @@ var BoundaryEventHandler = class {
|
|
|
1539
1546
|
/**
|
|
1540
1547
|
* Recalculate edge waypoints for edges connected to moved nodes
|
|
1541
1548
|
*/
|
|
1542
|
-
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo
|
|
1543
|
-
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo
|
|
1549
|
+
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo) {
|
|
1550
|
+
recalculateEdgesForMovedNodes(graph, movedNodes, boundaryEventInfo);
|
|
1544
1551
|
}
|
|
1545
1552
|
};
|
|
1546
1553
|
|
|
@@ -2427,7 +2434,7 @@ var LaneArranger = class {
|
|
|
2427
2434
|
const targetId = edge.targets?.[0];
|
|
2428
2435
|
const sourcePos = sourceId ? nodePositions.get(sourceId) : void 0;
|
|
2429
2436
|
const targetPos = targetId ? nodePositions.get(targetId) : void 0;
|
|
2430
|
-
if (
|
|
2437
|
+
if (isDebugEnabled()) {
|
|
2431
2438
|
console.log(`[BPMN] recalculatePoolEdges ${edge.id}: source=${sourceId}, target=${targetId}`);
|
|
2432
2439
|
console.log(`[BPMN] sourcePos=${JSON.stringify(sourcePos)}`);
|
|
2433
2440
|
console.log(`[BPMN] targetPos=${JSON.stringify(targetPos)}`);
|
|
@@ -2437,7 +2444,7 @@ var LaneArranger = class {
|
|
|
2437
2444
|
const startY = sourcePos.y + sourcePos.height / 2;
|
|
2438
2445
|
const endX = targetPos.x;
|
|
2439
2446
|
const endY = targetPos.y + targetPos.height / 2;
|
|
2440
|
-
if (
|
|
2447
|
+
if (isDebugEnabled()) {
|
|
2441
2448
|
console.log(`[BPMN] startX=${startX}, startY=${startY}, endX=${endX}, endY=${endY}`);
|
|
2442
2449
|
}
|
|
2443
2450
|
const waypoints = [];
|
|
@@ -2448,7 +2455,7 @@ var LaneArranger = class {
|
|
|
2448
2455
|
waypoints.push({ x: midX, y: endY });
|
|
2449
2456
|
}
|
|
2450
2457
|
waypoints.push({ x: endX, y: endY });
|
|
2451
|
-
if (
|
|
2458
|
+
if (isDebugEnabled()) {
|
|
2452
2459
|
console.log(`[BPMN] waypoints=${JSON.stringify(waypoints)}`);
|
|
2453
2460
|
}
|
|
2454
2461
|
edge._poolRelativeCoords = true;
|
|
@@ -2956,7 +2963,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
2956
2963
|
const gateways = /* @__PURE__ */ new Map();
|
|
2957
2964
|
this.collectGateways(layoutedGraph, originalGraph, gateways, 0, 0);
|
|
2958
2965
|
if (gateways.size === 0) return;
|
|
2959
|
-
if (
|
|
2966
|
+
if (isDebugEnabled()) {
|
|
2960
2967
|
console.log(`[BPMN] GatewayEdgeAdjuster: Found ${gateways.size} gateways`);
|
|
2961
2968
|
for (const [id, info] of gateways) {
|
|
2962
2969
|
console.log(`[BPMN] - ${id}: bounds=(${info.bounds.x},${info.bounds.y},${info.bounds.width},${info.bounds.height})`);
|
|
@@ -3043,7 +3050,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3043
3050
|
const section = edge.sections[0];
|
|
3044
3051
|
const sourceId = edge.sources?.[0];
|
|
3045
3052
|
const targetId = edge.targets?.[0];
|
|
3046
|
-
if (
|
|
3053
|
+
if (isDebugEnabled()) {
|
|
3047
3054
|
console.log(`[BPMN] GatewayEdgeAdjuster: Processing edge ${edge.id}, offset=(${offsetX},${offsetY})`);
|
|
3048
3055
|
console.log(`[BPMN] sourceId=${sourceId}, targetId=${targetId}`);
|
|
3049
3056
|
console.log(`[BPMN] startPoint=(${section.startPoint.x},${section.startPoint.y}), endPoint=(${section.endPoint.x},${section.endPoint.y})`);
|
|
@@ -3055,7 +3062,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3055
3062
|
}
|
|
3056
3063
|
const targetGateway = targetId ? gateways.get(targetId) : void 0;
|
|
3057
3064
|
if (targetGateway) {
|
|
3058
|
-
if (
|
|
3065
|
+
if (isDebugEnabled()) {
|
|
3059
3066
|
console.log(`[BPMN] target gateway: ${targetId}, bounds=(${targetGateway.bounds.x},${targetGateway.bounds.y})`);
|
|
3060
3067
|
console.log(`[BPMN] left corner: (${targetGateway.corners.left.x},${targetGateway.corners.left.y})`);
|
|
3061
3068
|
}
|
|
@@ -3126,7 +3133,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3126
3133
|
lastBend.x = newEnd.x;
|
|
3127
3134
|
}
|
|
3128
3135
|
}
|
|
3129
|
-
if (
|
|
3136
|
+
if (isDebugEnabled()) {
|
|
3130
3137
|
console.log(`[BPMN] GatewayEdgeAdjuster: Adjusted edge ${edge.id} endpoint from (${endX},${endY}) to (${targetCorner.x},${targetCorner.y})`);
|
|
3131
3138
|
}
|
|
3132
3139
|
} else {
|
|
@@ -3140,7 +3147,7 @@ var GatewayEdgeAdjuster = class {
|
|
|
3140
3147
|
x: intersectionPoint.x - offsetX,
|
|
3141
3148
|
y: intersectionPoint.y - offsetY
|
|
3142
3149
|
};
|
|
3143
|
-
if (
|
|
3150
|
+
if (isDebugEnabled()) {
|
|
3144
3151
|
console.log(`[BPMN] GatewayEdgeAdjuster: Adjusted edge ${edge.id} endpoint to diamond intersection (${intersectionPoint.x},${intersectionPoint.y})`);
|
|
3145
3152
|
}
|
|
3146
3153
|
}
|
|
@@ -3400,7 +3407,7 @@ var ElkGraphPreparer = class {
|
|
|
3400
3407
|
for (const startId of startEvents) {
|
|
3401
3408
|
traverseMainFlow(startId);
|
|
3402
3409
|
}
|
|
3403
|
-
if (
|
|
3410
|
+
if (isDebugEnabled()) {
|
|
3404
3411
|
console.log(`[BPMN] Main flow nodes: ${Array.from(mainFlowNodes).join(", ")}`);
|
|
3405
3412
|
}
|
|
3406
3413
|
return mainFlowNodes;
|
|
@@ -3735,7 +3742,7 @@ var ResultMerger = class {
|
|
|
3735
3742
|
return originalEdges.map((origEdge) => {
|
|
3736
3743
|
const layoutedEdge = layoutedEdgeMap.get(origEdge.id);
|
|
3737
3744
|
if (layoutedEdge) {
|
|
3738
|
-
if (
|
|
3745
|
+
if (isDebugEnabled() && layoutedEdge.sections?.[0]?.bendPoints?.length) {
|
|
3739
3746
|
console.log(`[BPMN] Merge ${origEdge.id}: bendPoints=${JSON.stringify(layoutedEdge.sections[0].bendPoints)}`);
|
|
3740
3747
|
}
|
|
3741
3748
|
const mergedEdge = {
|
|
@@ -3873,7 +3880,7 @@ var MainFlowNormalizer = class {
|
|
|
3873
3880
|
return;
|
|
3874
3881
|
}
|
|
3875
3882
|
const offsetY = currentMinY - TARGET_MAIN_FLOW_Y;
|
|
3876
|
-
if (
|
|
3883
|
+
if (isDebugEnabled()) {
|
|
3877
3884
|
console.log(`[BPMN] Normalizing main flow: currentMinY=${currentMinY}, offsetY=${offsetY}`);
|
|
3878
3885
|
console.log(`[BPMN] Upstream nodes: ${upstreamMainFlow.map((n) => n.id).join(", ")}`);
|
|
3879
3886
|
console.log(`[BPMN] Downstream nodes: ${downstreamMainFlow.map((n) => n.id).join(", ")}`);
|
|
@@ -3881,7 +3888,7 @@ var MainFlowNormalizer = class {
|
|
|
3881
3888
|
for (const node of otherUpstreamNodes) {
|
|
3882
3889
|
if (node.y !== void 0) {
|
|
3883
3890
|
node.y -= offsetY;
|
|
3884
|
-
if (
|
|
3891
|
+
if (isDebugEnabled()) {
|
|
3885
3892
|
console.log(`[BPMN] Shifted upstream ${node.id} to y=${node.y}`);
|
|
3886
3893
|
}
|
|
3887
3894
|
}
|
|
@@ -3894,14 +3901,14 @@ var MainFlowNormalizer = class {
|
|
|
3894
3901
|
const predecessorCenterY = predecessor.y + (predecessor.height ?? 80) / 2;
|
|
3895
3902
|
const endNodeCenterY = (endNode.height ?? 36) / 2;
|
|
3896
3903
|
endNode.y = predecessorCenterY - endNodeCenterY;
|
|
3897
|
-
if (
|
|
3904
|
+
if (isDebugEnabled()) {
|
|
3898
3905
|
console.log(`[BPMN] Aligned endEvent ${endNode.id} with predecessor ${predecessorId}: y=${endNode.y}`);
|
|
3899
3906
|
}
|
|
3900
3907
|
}
|
|
3901
3908
|
} else {
|
|
3902
3909
|
if (endNode.y !== void 0) {
|
|
3903
3910
|
endNode.y -= offsetY;
|
|
3904
|
-
if (
|
|
3911
|
+
if (isDebugEnabled()) {
|
|
3905
3912
|
console.log(`[BPMN] Shifted upstream ${endNode.id} to y=${endNode.y} (no predecessor found)`);
|
|
3906
3913
|
}
|
|
3907
3914
|
}
|
|
@@ -3929,7 +3936,7 @@ var MainFlowNormalizer = class {
|
|
|
3929
3936
|
const newY = prevBottom + MIN_SPACING;
|
|
3930
3937
|
currNode.y = newY;
|
|
3931
3938
|
adjustedEndEvents.set(currNode.id, newY);
|
|
3932
|
-
if (
|
|
3939
|
+
if (isDebugEnabled()) {
|
|
3933
3940
|
console.log(`[BPMN] Adjusted overlapping endEvent ${currNode.id} at x=${x}: y=${currNode.y}`);
|
|
3934
3941
|
}
|
|
3935
3942
|
}
|
|
@@ -3953,7 +3960,7 @@ var MainFlowNormalizer = class {
|
|
|
3953
3960
|
for (const node of downstreamMainFlow) {
|
|
3954
3961
|
if (node.y !== void 0) {
|
|
3955
3962
|
node.y -= downstreamOffsetY;
|
|
3956
|
-
if (
|
|
3963
|
+
if (isDebugEnabled()) {
|
|
3957
3964
|
console.log(`[BPMN] Shifted downstream ${node.id} to y=${node.y}`);
|
|
3958
3965
|
}
|
|
3959
3966
|
}
|
|
@@ -4135,20 +4142,20 @@ var MainFlowNormalizer = class {
|
|
|
4135
4142
|
lastBend.y = newTargetY;
|
|
4136
4143
|
section.endPoint.y = newTargetY;
|
|
4137
4144
|
edgesWithAdjustedEndpoint.add(edge.id);
|
|
4138
|
-
if (
|
|
4145
|
+
if (isDebugEnabled()) {
|
|
4139
4146
|
console.log(`[BPMN] Updated edge ${edge.id} last bendPoint and endpoint to y=${newTargetY}`);
|
|
4140
4147
|
}
|
|
4141
4148
|
} else {
|
|
4142
4149
|
section.endPoint.y = newTargetY;
|
|
4143
4150
|
edgesWithAdjustedEndpoint.add(edge.id);
|
|
4144
|
-
if (
|
|
4151
|
+
if (isDebugEnabled()) {
|
|
4145
4152
|
console.log(`[BPMN] Updated edge ${edge.id} endpoint to y=${newTargetY}`);
|
|
4146
4153
|
}
|
|
4147
4154
|
}
|
|
4148
4155
|
} else if (section.endPoint) {
|
|
4149
4156
|
section.endPoint.y = newTargetY;
|
|
4150
4157
|
edgesWithAdjustedEndpoint.add(edge.id);
|
|
4151
|
-
if (
|
|
4158
|
+
if (isDebugEnabled()) {
|
|
4152
4159
|
console.log(`[BPMN] Updated edge ${edge.id} endpoint to y=${newTargetY}`);
|
|
4153
4160
|
}
|
|
4154
4161
|
}
|
|
@@ -4262,7 +4269,7 @@ var GatewayPropagator = class {
|
|
|
4262
4269
|
offset: 0,
|
|
4263
4270
|
newX
|
|
4264
4271
|
});
|
|
4265
|
-
if (
|
|
4272
|
+
if (isDebugEnabled()) {
|
|
4266
4273
|
console.log(`[BPMN] Propagating gateway movement to ${targetId}: x ${currentX} -> ${newX}`);
|
|
4267
4274
|
}
|
|
4268
4275
|
this.propagateDownstreamX(targetId, newX, targetNode.width ?? 100, nodeMap, edgeMap, mainFlowNodes, gatewayMoves);
|
|
@@ -4290,7 +4297,7 @@ var GatewayPropagator = class {
|
|
|
4290
4297
|
offset: 0,
|
|
4291
4298
|
newX
|
|
4292
4299
|
});
|
|
4293
|
-
if (
|
|
4300
|
+
if (isDebugEnabled()) {
|
|
4294
4301
|
console.log(`[BPMN] Propagating X to ${targetId}: x ${currentX} -> ${newX}`);
|
|
4295
4302
|
}
|
|
4296
4303
|
this.propagateDownstreamX(targetId, newX, targetNode.width ?? 100, nodeMap, edgeMap, mainFlowNodes, moves);
|
|
@@ -4345,14 +4352,14 @@ var ElkLayouter = class {
|
|
|
4345
4352
|
const layoutedElkGraph = await this.elk.layout(elkGraph);
|
|
4346
4353
|
const mainFlowNodes = this.graphPreparer.identifyMainFlowNodes(sizedGraph, boundaryEventTargetIds);
|
|
4347
4354
|
this.mainFlowNormalizer.normalize(layoutedElkGraph, mainFlowNodes, boundaryEventTargetIds, sizedGraph);
|
|
4348
|
-
const movedNodes = this.boundaryEventHandler.identifyNodesToMove(layoutedElkGraph, boundaryEventInfo, sizedGraph,
|
|
4355
|
+
const movedNodes = this.boundaryEventHandler.identifyNodesToMove(layoutedElkGraph, boundaryEventInfo, sizedGraph, isDebugEnabled());
|
|
4349
4356
|
if (movedNodes.size > 0) {
|
|
4350
4357
|
this.boundaryEventHandler.applyNodeMoves(layoutedElkGraph, movedNodes);
|
|
4351
4358
|
const gatewayMoves = this.boundaryEventHandler.repositionConvergingGateways(
|
|
4352
4359
|
layoutedElkGraph,
|
|
4353
4360
|
movedNodes,
|
|
4354
4361
|
boundaryEventInfo,
|
|
4355
|
-
|
|
4362
|
+
isDebugEnabled()
|
|
4356
4363
|
);
|
|
4357
4364
|
if (gatewayMoves.size > 0) {
|
|
4358
4365
|
this.boundaryEventHandler.applyNodeMoves(layoutedElkGraph, gatewayMoves);
|
|
@@ -4361,7 +4368,7 @@ var ElkLayouter = class {
|
|
|
4361
4368
|
for (const [id, move] of gatewayMoves) {
|
|
4362
4369
|
movedNodes.set(id, move);
|
|
4363
4370
|
}
|
|
4364
|
-
this.boundaryEventHandler.recalculateEdgesForMovedNodes(layoutedElkGraph, movedNodes, boundaryEventInfo
|
|
4371
|
+
this.boundaryEventHandler.recalculateEdgesForMovedNodes(layoutedElkGraph, movedNodes, boundaryEventInfo);
|
|
4365
4372
|
}
|
|
4366
4373
|
this.artifactPositioner.reposition(layoutedElkGraph, artifactInfo);
|
|
4367
4374
|
this.laneArranger.rearrange(layoutedElkGraph, sizedGraph);
|
|
@@ -4635,7 +4642,7 @@ function adjustGatewayEndpoint(endpoint, adjacentPoint, gatewayBounds, isSource)
|
|
|
4635
4642
|
const gatewayCenterX = gatewayBounds.x + gatewayBounds.width / 2;
|
|
4636
4643
|
const gatewayCenterY = gatewayBounds.y + gatewayBounds.height / 2;
|
|
4637
4644
|
const tolerance = 1;
|
|
4638
|
-
if (
|
|
4645
|
+
if (isDebugEnabled()) {
|
|
4639
4646
|
console.log(`[BPMN] adjustGatewayEndpoint: isSource=${isSource}`);
|
|
4640
4647
|
console.log(` endpoint: (${endpoint.x}, ${endpoint.y})`);
|
|
4641
4648
|
console.log(` gatewayBounds: x=${gatewayBounds.x}, y=${gatewayBounds.y}, w=${gatewayBounds.width}, h=${gatewayBounds.height}`);
|
|
@@ -4647,22 +4654,22 @@ function adjustGatewayEndpoint(endpoint, adjacentPoint, gatewayBounds, isSource)
|
|
|
4647
4654
|
const topCorner = { x: gatewayCenterX, y: gatewayBounds.y };
|
|
4648
4655
|
const bottomCorner = { x: gatewayCenterX, y: gatewayBounds.y + gatewayBounds.height };
|
|
4649
4656
|
if (Math.abs(endpoint.x - gatewayBounds.x) < tolerance && Math.abs(endpoint.y - gatewayCenterY) < tolerance) {
|
|
4650
|
-
if (
|
|
4657
|
+
if (isDebugEnabled()) console.log(` -> Already at LEFT corner, no adjustment`);
|
|
4651
4658
|
return endpoint;
|
|
4652
4659
|
}
|
|
4653
4660
|
if (Math.abs(endpoint.x - (gatewayBounds.x + gatewayBounds.width)) < tolerance && Math.abs(endpoint.y - gatewayCenterY) < tolerance) {
|
|
4654
|
-
if (
|
|
4661
|
+
if (isDebugEnabled()) console.log(` -> Already at RIGHT corner, no adjustment`);
|
|
4655
4662
|
return endpoint;
|
|
4656
4663
|
}
|
|
4657
4664
|
if (Math.abs(endpoint.y - gatewayBounds.y) < tolerance && Math.abs(endpoint.x - gatewayCenterX) < tolerance) {
|
|
4658
|
-
if (
|
|
4665
|
+
if (isDebugEnabled()) console.log(` -> Already at TOP corner, no adjustment`);
|
|
4659
4666
|
return endpoint;
|
|
4660
4667
|
}
|
|
4661
4668
|
if (Math.abs(endpoint.y - (gatewayBounds.y + gatewayBounds.height)) < tolerance && Math.abs(endpoint.x - gatewayCenterX) < tolerance) {
|
|
4662
|
-
if (
|
|
4669
|
+
if (isDebugEnabled()) console.log(` -> Already at BOTTOM corner, no adjustment`);
|
|
4663
4670
|
return endpoint;
|
|
4664
4671
|
}
|
|
4665
|
-
if (
|
|
4672
|
+
if (isDebugEnabled()) {
|
|
4666
4673
|
console.log(` -> NOT at corner, will adjust`);
|
|
4667
4674
|
}
|
|
4668
4675
|
const result = calculateDiamondIntersection(
|
|
@@ -4673,7 +4680,7 @@ function adjustGatewayEndpoint(endpoint, adjacentPoint, gatewayBounds, isSource)
|
|
|
4673
4680
|
isSource,
|
|
4674
4681
|
adjacentPoint
|
|
4675
4682
|
);
|
|
4676
|
-
if (
|
|
4683
|
+
if (isDebugEnabled()) {
|
|
4677
4684
|
console.log(` -> Adjusted to: (${result.x}, ${result.y})`);
|
|
4678
4685
|
}
|
|
4679
4686
|
return result;
|
|
@@ -4978,7 +4985,7 @@ var DiagramBuilder = class {
|
|
|
4978
4985
|
const targetIsGateway = this.isGatewayType(targetNode?.type);
|
|
4979
4986
|
let waypoints = [];
|
|
4980
4987
|
const hasPreCalculatedSections = edge.sections && edge.sections.length > 0 && edge.sections[0]?.bendPoints && edge.sections[0].bendPoints.length > 0;
|
|
4981
|
-
if (
|
|
4988
|
+
if (isDebugEnabled() && bePosition) {
|
|
4982
4989
|
console.log(`[BPMN] buildEdge ${edge.id}: preCalculated=${hasPreCalculatedSections}`);
|
|
4983
4990
|
}
|
|
4984
4991
|
if (bePosition && targetPosition && !hasPreCalculatedSections) {
|