Skip to content

Commit

Permalink
fix: auto-place elements vertically in sub processes
Browse files Browse the repository at this point in the history
  • Loading branch information
sombrek committed Aug 2, 2024
1 parent e39b256 commit 2778216
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/features/modeling/util/ModelingUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -67,6 +69,10 @@ export function isDirectionHorizontal(element, elementRegistry) {
}
}

if (elementRegistry === undefined) {
return true;

Check warning on line 73 in lib/features/modeling/util/ModelingUtil.js

View check run for this annotation

Codecov / codecov/patch

lib/features/modeling/util/ModelingUtil.js#L73

Added line #L73 was not covered by tests
}

// 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.
Expand Down

0 comments on commit 2778216

Please # to comment.