From 27782169b65960e1ccb830303103e345bec5e74c Mon Sep 17 00:00:00 2001 From: Daniel <150448993+sombrek@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:01:17 +0200 Subject: [PATCH] fix: auto-place elements vertically in sub processes --- lib/features/modeling/util/ModelingUtil.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/features/modeling/util/ModelingUtil.js b/lib/features/modeling/util/ModelingUtil.js index feec95de9..df9a9f7a7 100644 --- a/lib/features/modeling/util/ModelingUtil.js +++ b/lib/features/modeling/util/ModelingUtil.js @@ -46,17 +46,19 @@ export function getParent(element, anyType) { * * @return {boolean} false for vertical pools, lanes and their children. true otherwise */ -export function isDirectionHorizontal(element, elementRegistry) { +export function isDirectionHorizontal(element, elementRegistry = undefined) { var parent = getParent(element, 'bpmn:Process'); if (parent) { return true; } - parent = getParent(element, 'bpmn:Participant'); + var types = [ 'bpmn:Participant', 'bpmn:Lane' ]; + + parent = getParent(element, types); if (parent) { return isHorizontal(parent); - } else if (is(element, 'bpmn:Participant')) { + } else if (is(element, types)) { return isHorizontal(element); } @@ -67,6 +69,10 @@ export function isDirectionHorizontal(element, elementRegistry) { } } + if (elementRegistry === undefined) { + return true; + } + // The direction may be specified in another diagram. We ignore that there // could be multiple diagrams with contradicting properties based on the // assumption that such BPMN files are unusual.