From 98bc96caac73efc451ae75f043db5da104348a52 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 10 Feb 2020 19:33:50 +0100 Subject: [PATCH 01/27] test(Viewer): move missing diagram spec --- test/spec/ViewerSpec.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/test/spec/ViewerSpec.js b/test/spec/ViewerSpec.js index 29bc3824..fcf3ac78 100644 --- a/test/spec/ViewerSpec.js +++ b/test/spec/ViewerSpec.js @@ -267,6 +267,21 @@ describe('Viewer', function() { }); }); + + it('should throw error due to missing diagram', function(done) { + + var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); + + // when + createViewer(xml, function(err, warnings) { + + // then + expect(err.message).to.eql('no diagram to display'); + + done(); + }); + }); + }); @@ -549,25 +564,6 @@ describe('Viewer', function() { }); - - it('should throw error due to missing diagram', function(done) { - - var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); - - // given - viewer = new Viewer({ container: container, additionalModules: testModules }); - - // when - viewer.importXML(xml, function(err) { - - // then - expect(err.message).to.eql('no diagram to display'); - - done(); - }); - - }); - }); From ffa0a88d30028f2fe14230b4fda8e0d0d2ce360f Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 9 Mar 2020 10:48:05 +0100 Subject: [PATCH 02/27] fix(modeling): update AddLaneHandler to new spaceTool API Related to https://github.com/camunda/camunda-modeler/issues/1715 --- lib/features/modeling/cmd/AddLaneHandler.js | 8 ++- .../features/modeling/lanes/AddLaneSpec.js | 54 +++++++++++++++++-- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/lib/features/modeling/cmd/AddLaneHandler.js b/lib/features/modeling/cmd/AddLaneHandler.js index ba2a34ad..711de3d7 100644 --- a/lib/features/modeling/cmd/AddLaneHandler.js +++ b/lib/features/modeling/cmd/AddLaneHandler.js @@ -77,7 +77,13 @@ AddLaneHandler.prototype.preExecute = function(context) { var adjustments = spaceTool.calculateAdjustments(allAffected, 'y', offset, spacePos); - spaceTool.makeSpace(adjustments.movingShapes, adjustments.resizingShapes, { x: 0, y: offset }, direction); + spaceTool.makeSpace( + adjustments.movingShapes, + adjustments.resizingShapes, + { x: 0, y: offset }, + direction, + spacePos + ); // (2) create new lane at open space context.newLane = modeling.createShape({ type: 'bpmn:Lane' }, { diff --git a/test/spec/features/modeling/lanes/AddLaneSpec.js b/test/spec/features/modeling/lanes/AddLaneSpec.js index b7229034..1b5d128d 100644 --- a/test/spec/features/modeling/lanes/AddLaneSpec.js +++ b/test/spec/features/modeling/lanes/AddLaneSpec.js @@ -20,6 +20,8 @@ import { query as domQuery } from 'min-dom'; var DEFAULT_LANE_HEIGHT = 120; +var testModules = [ coreModule, modelingModule ]; + function getBounds(element) { return pick(element, [ 'x', 'y', 'width', 'height' ]); @@ -32,9 +34,10 @@ describe('features/modeling - add Lane', function() { var diagramXML = require('./lanes.bpmn'); - var testModules = [ coreModule, modelingModule ]; + beforeEach(bootstrapModeler(diagramXML, { + modules: testModules + })); - beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); it('should add after Lane', inject(function(elementRegistry, modeling) { @@ -191,9 +194,9 @@ describe('features/modeling - add Lane', function() { var diagramXML = require('./participant-no-lane.bpmn'); - var testModules = [ coreModule, modelingModule ]; - - beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); + beforeEach(bootstrapModeler(diagramXML, { + modules: testModules + })); it('should add after Participant', inject(function(elementRegistry, modeling) { @@ -267,6 +270,47 @@ describe('features/modeling - add Lane', function() { }); + describe('flow node handling', function() { + + var diagramXML = require('./lanes.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { + modules: testModules + })); + + + it('should move flow nodes and sequence flows', inject(function(elementRegistry, modeling) { + + // given + var laneShape = elementRegistry.get('Nested_Lane_B'), + task_Boundary = elementRegistry.get('Task_Boundary'), + boundary = elementRegistry.get('Boundary'), + sequenceFlow = elementRegistry.get('SequenceFlow'), + sequenceFlow_From_Boundary = elementRegistry.get('SequenceFlow_From_Boundary'); + + // when + var newLane = modeling.addLane(laneShape, 'top'); + + // then + expect(task_Boundary).to.have.position({ x: 264, y: -57 }); + expect(boundary).to.have.position({ x: 311, y: 5 }); + + expect(sequenceFlow_From_Boundary).to.have.waypoints([ + { x: 329, y: 161 - newLane.height }, + { x: 329, y: 188 - newLane.height }, + { x: 482, y: 188 - newLane.height }, + { x: 482, y: 143 - newLane.height } + ]); + + expect(sequenceFlow).to.have.waypoints([ + { x: 364, y: 103 - newLane.height }, + { x: 432, y: 103 - newLane.height } + ]); + })); + + }); + + describe('Internet Explorer', function() { var diagramXML = require('./participant-single-lane.bpmn'); From dafa6f138c3584182d75ce9f454d1013744e63d5 Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Tue, 10 Mar 2020 19:48:21 +0100 Subject: [PATCH 03/27] fix(space-tool): consider lanes when resizing participant Related to camunda/camunda-modeler#1703 --- .../modeling/behavior/ResizeBehavior.js | 2 + .../modeling/behavior/SpaceToolBehavior.js | 73 ++++++++++++++++- .../modeling/behavior/util/ResizeUtil.js | 18 ++--- .../behavior/SpaceToolBehaviorSpec.js | 81 ++++++++++++++++++- .../SpaceToolBehaviorSpec.participant.bpmn | 57 +++++++++++++ ... => SpaceToolBehaviorSpec.subprocess.bpmn} | 0 6 files changed, 216 insertions(+), 15 deletions(-) create mode 100644 test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn rename test/spec/features/modeling/behavior/{SpaceToolBehaviorSpec.bpmn => SpaceToolBehaviorSpec.subprocess.bpmn} (100%) diff --git a/lib/features/modeling/behavior/ResizeBehavior.js b/lib/features/modeling/behavior/ResizeBehavior.js index f72d16d2..935752cf 100644 --- a/lib/features/modeling/behavior/ResizeBehavior.js +++ b/lib/features/modeling/behavior/ResizeBehavior.js @@ -6,6 +6,8 @@ import { getParticipantResizeConstraints } from './util/ResizeUtil'; var HIGH_PRIORITY = 1500; +export var LANE_MIN_DIMENSIONS = { width: 300, height: 60 }; + export var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 }; export var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 }; diff --git a/lib/features/modeling/behavior/SpaceToolBehavior.js b/lib/features/modeling/behavior/SpaceToolBehavior.js index 64e19ee3..593fcef5 100644 --- a/lib/features/modeling/behavior/SpaceToolBehavior.js +++ b/lib/features/modeling/behavior/SpaceToolBehavior.js @@ -1,25 +1,45 @@ -import { forEach } from 'min-dash'; +import { + forEach, + reduce +} from 'min-dash'; import { is } from '../../../util/ModelUtil'; import { isExpanded } from '../../../util/DiUtil'; import { + LANE_MIN_DIMENSIONS, PARTICIPANT_MIN_DIMENSIONS, SUB_PROCESS_MIN_DIMENSIONS, TEXT_ANNOTATION_MIN_DIMENSIONS } from './ResizeBehavior'; +import { getChildLanes } from '../util/LaneUtil'; + +var max = Math.max; + + export default function SpaceToolBehavior(eventBus) { eventBus.on('spaceTool.getMinDimensions', function(context) { var shapes = context.shapes, + axis = context.axis, + start = context.start, minDimensions = {}; forEach(shapes, function(shape) { var id = shape.id; if (is(shape, 'bpmn:Participant')) { - minDimensions[ id ] = PARTICIPANT_MIN_DIMENSIONS; + + if (isHorizontal(axis)) { + minDimensions[ id ] = PARTICIPANT_MIN_DIMENSIONS; + } else { + minDimensions[ id ] = { + width: PARTICIPANT_MIN_DIMENSIONS.width, + height: getParticipantMinHeight(shape, start) + }; + } + } if (is(shape, 'bpmn:SubProcess') && isExpanded(shape)) { @@ -36,3 +56,52 @@ export default function SpaceToolBehavior(eventBus) { } SpaceToolBehavior.$inject = [ 'eventBus' ]; + + +// helpers ////////// + +/** + * Get minimum height for participant taking lanes into account. + * + * @param {} participant + * @param {number} start + * + * @returns {Object} + */ +function getParticipantMinHeight(participant, start) { + var lanes = getChildLanes(participant); + + if (!lanes.length) { + return PARTICIPANT_MIN_DIMENSIONS.height; + } + + function getLanesMinHeight(element) { + return reduce(getChildLanes(element), function(minHeight, lane) { + if (start >= lane.y && start <= lane.y + lane.height) { + + // resizing lane + if (hasChildLanes(lane)) { + minHeight += getLanesMinHeight(lane); + } else { + minHeight += lane.y + LANE_MIN_DIMENSIONS.height - participant.y; + } + } else if (start <= lane.y) { + + // lane after resizing lane + minHeight += lane.height; + } + + return minHeight; + }, 0); + } + + return max(PARTICIPANT_MIN_DIMENSIONS.height, getLanesMinHeight(participant)); +} + +function hasChildLanes(element) { + return !!getChildLanes(element).length; +} + +function isHorizontal(axis) { + return axis === 'x'; +} \ No newline at end of file diff --git a/lib/features/modeling/behavior/util/ResizeUtil.js b/lib/features/modeling/behavior/util/ResizeUtil.js index bf0bb2a9..f0bfd86e 100644 --- a/lib/features/modeling/behavior/util/ResizeUtil.js +++ b/lib/features/modeling/behavior/util/ResizeUtil.js @@ -9,6 +9,8 @@ import { getLanesRoot } from '../../../modeling/util/LaneUtil'; +import { LANE_MIN_DIMENSIONS } from '../ResizeBehavior'; + var abs = Math.abs, min = Math.min, max = Math.max; @@ -31,9 +33,7 @@ function addMax(trbl, attr, value) { return addToTrbl(trbl, attr, value, max); } -var LANE_MIN_HEIGHT = 60, - LANE_MIN_WIDTH = 300, - LANE_RIGHT_PADDING = 20, +var LANE_RIGHT_PADDING = 20, LANE_LEFT_PADDING = 50, LANE_TOP_PADDING = 20, LANE_BOTTOM_PADDING = 20; @@ -54,10 +54,10 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala minTrbl = {}; if (/e/.test(resizeDirection)) { - minTrbl.right = laneTrbl.left + LANE_MIN_WIDTH; + minTrbl.right = laneTrbl.left + LANE_MIN_DIMENSIONS.width; } else if (/w/.test(resizeDirection)) { - minTrbl.left = laneTrbl.right - LANE_MIN_WIDTH; + minTrbl.left = laneTrbl.right - LANE_MIN_DIMENSIONS.width; } allLanes.forEach(function(other) { @@ -72,12 +72,12 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala // max top size (based on next element) if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) { - addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_HEIGHT); + addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_DIMENSIONS.height); } // min top size (based on self or nested element) if (abs(laneTrbl.top - otherTrbl.top) < 5) { - addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_HEIGHT); + addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height); } } @@ -89,12 +89,12 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala // max bottom size (based on previous element) if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) { - addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_HEIGHT); + addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height); } // min bottom size (based on self or nested element) if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) { - addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_HEIGHT); + addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_DIMENSIONS.height); } } }); diff --git a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js index 7dd9be19..459ed5d9 100644 --- a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js @@ -13,7 +13,11 @@ import { createCanvasEvent as canvasEvent } from '../../../../util/MockEvents'; -import { SUB_PROCESS_MIN_DIMENSIONS } from 'lib/features/modeling/behavior/ResizeBehavior'; +import { + LANE_MIN_DIMENSIONS, + PARTICIPANT_MIN_DIMENSIONS, + SUB_PROCESS_MIN_DIMENSIONS +} from 'lib/features/modeling/behavior/ResizeBehavior'; var testModules = [ coreModule, @@ -26,16 +30,16 @@ var testModules = [ describe('features/modeling - space tool behavior', function() { - describe('participant', function() { + describe('subprocess', function() { describe('minimum dimensions', function() { - var diagramXML = require('./SpaceToolBehaviorSpec.bpmn'); + var diagramXML = require('./SpaceToolBehaviorSpec.subprocess.bpmn'); beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); - it('should ensure minimum dimensions', inject( + it('should ensure subprocess minimum dimensions', inject( function(dragging, elementRegistry, spaceTool) { // given @@ -57,4 +61,73 @@ describe('features/modeling - space tool behavior', function() { }); + describe('participant', function() { + + describe('minimum dimensions', function() { + + var diagramXML = require('./SpaceToolBehaviorSpec.participant.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); + + + it('should ensure participant minimum dimensions', inject( + function(dragging, elementRegistry, spaceTool) { + + // given + var participant = elementRegistry.get('Participant_1'); + + // when + spaceTool.activateMakeSpace(canvasEvent({ x: 300, y: 0 })); + + dragging.move(canvasEvent({ x: 0, y: 0 })); + + dragging.end(); + + // then + expect(participant.width).to.equal(PARTICIPANT_MIN_DIMENSIONS.width); + }) + ); + + + it('should ensure lane minimum dimensions', inject( + function(dragging, elementRegistry, spaceTool) { + + // given + var lane = elementRegistry.get('Lane_1'); + + // when + spaceTool.activateMakeSpace(canvasEvent({ x: 0, y: 400 })); + + dragging.move(canvasEvent({ x: 0, y: 0 })); + + dragging.end(); + + // then + expect(lane.height).to.equal(LANE_MIN_DIMENSIONS.height); + }) + ); + + + it('should ensure nested lane minimum dimensions', inject( + function(dragging, elementRegistry, spaceTool) { + + // given + var lane = elementRegistry.get('Lane_6'); + + // when + spaceTool.activateMakeSpace(canvasEvent({ x: 0, y: 925 })); + + dragging.move(canvasEvent({ x: 0, y: 0 })); + + dragging.end(); + + // then + expect(lane.height).to.equal(LANE_MIN_DIMENSIONS.height); + }) + ); + + }); + + }); + }); \ No newline at end of file diff --git a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn new file mode 100644 index 00000000..a8ea2dc7 --- /dev/null +++ b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.bpmn b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.subprocess.bpmn similarity index 100% rename from test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.bpmn rename to test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.subprocess.bpmn From 6388312fb545a1f3c974f56eb693dd121f14d360 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Thu, 12 Mar 2020 15:00:52 +0100 Subject: [PATCH 04/27] chore(space-tool): refactor participant minimum height function --- .../modeling/behavior/SpaceToolBehavior.js | 75 ++++++++++++------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/lib/features/modeling/behavior/SpaceToolBehavior.js b/lib/features/modeling/behavior/SpaceToolBehavior.js index 593fcef5..4949f5bb 100644 --- a/lib/features/modeling/behavior/SpaceToolBehavior.js +++ b/lib/features/modeling/behavior/SpaceToolBehavior.js @@ -1,7 +1,4 @@ -import { - forEach, - reduce -} from 'min-dash'; +import { forEach } from 'min-dash'; import { is } from '../../../util/ModelUtil'; @@ -59,6 +56,9 @@ SpaceToolBehavior.$inject = [ 'eventBus' ]; // helpers ////////// +function isHorizontal(axis) { + return axis === 'x'; +} /** * Get minimum height for participant taking lanes into account. @@ -69,39 +69,56 @@ SpaceToolBehavior.$inject = [ 'eventBus' ]; * @returns {Object} */ function getParticipantMinHeight(participant, start) { - var lanes = getChildLanes(participant); + var lanesMinHeight; - if (!lanes.length) { + if (!hasChildLanes(participant)) { return PARTICIPANT_MIN_DIMENSIONS.height; } - function getLanesMinHeight(element) { - return reduce(getChildLanes(element), function(minHeight, lane) { - if (start >= lane.y && start <= lane.y + lane.height) { + lanesMinHeight = getLanesMinHeight(participant, start); - // resizing lane - if (hasChildLanes(lane)) { - minHeight += getLanesMinHeight(lane); - } else { - minHeight += lane.y + LANE_MIN_DIMENSIONS.height - participant.y; - } - } else if (start <= lane.y) { - - // lane after resizing lane - minHeight += lane.height; - } - - return minHeight; - }, 0); - } - - return max(PARTICIPANT_MIN_DIMENSIONS.height, getLanesMinHeight(participant)); + return max(PARTICIPANT_MIN_DIMENSIONS.height, lanesMinHeight); } function hasChildLanes(element) { return !!getChildLanes(element).length; } -function isHorizontal(axis) { - return axis === 'x'; -} \ No newline at end of file +function getLanesMinHeight(participant, resizeStart) { + var lanes = getChildLanes(participant), + resizedLane; + + // find the nested lane which is currently resized + resizedLane = findResizedLane(lanes, resizeStart); + + // resized lane cannot shrink below the minimum height + // but remaining lanes' dimensions are kept intact + return participant.height - resizedLane.height + LANE_MIN_DIMENSIONS.height; +} + +/** + * Find nested lane which is currently resized. + * + * @param {Array} lanes + * @param {number} resizeStart + */ +function findResizedLane(lanes, resizeStart) { + var i, lane, childLanes; + + for (i = 0; i < lanes.length; i++) { + lane = lanes[i]; + + // resizing current lane or a lane nested + if (resizeStart >= lane.y && resizeStart <= lane.y + lane.height) { + childLanes = getChildLanes(lane); + + // a nested lane is resized + if (childLanes.length) { + return findResizedLane(childLanes, resizeStart); + } + + // current lane is the resized one + return lane; + } + } +} From b4eff93580ec9e7eef9db1b656ef305e4ab30e5d Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Fri, 13 Mar 2020 07:39:39 +0100 Subject: [PATCH 05/27] chore(space-tool): add tests for participant without lanes --- .../behavior/SpaceToolBehaviorSpec.js | 27 ++++++++++++++++--- .../SpaceToolBehaviorSpec.participant.bpmn | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js index 459ed5d9..6529b11e 100644 --- a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.js @@ -70,7 +70,7 @@ describe('features/modeling - space tool behavior', function() { beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); - it('should ensure participant minimum dimensions', inject( + it('should ensure participant minimum width', inject( function(dragging, elementRegistry, spaceTool) { // given @@ -79,7 +79,7 @@ describe('features/modeling - space tool behavior', function() { // when spaceTool.activateMakeSpace(canvasEvent({ x: 300, y: 0 })); - dragging.move(canvasEvent({ x: 0, y: 0 })); + dragging.move(canvasEvent({ x: -200, y: 0 })); dragging.end(); @@ -89,7 +89,26 @@ describe('features/modeling - space tool behavior', function() { ); - it('should ensure lane minimum dimensions', inject( + it('should ensure participant minimum height', inject( + function(dragging, elementRegistry, spaceTool) { + + // given + var participant = elementRegistry.get('Participant_1'); + + // when + spaceTool.activateMakeSpace(canvasEvent({ x: 0, y: 100 })); + + dragging.move(canvasEvent({ x: 0, y: -400 })); + + dragging.end(); + + // then + expect(participant.height).to.equal(PARTICIPANT_MIN_DIMENSIONS.height); + }) + ); + + + it('should ensure lane minimum height', inject( function(dragging, elementRegistry, spaceTool) { // given @@ -108,7 +127,7 @@ describe('features/modeling - space tool behavior', function() { ); - it('should ensure nested lane minimum dimensions', inject( + it('should ensure nested lane minimum height', inject( function(dragging, elementRegistry, spaceTool) { // given diff --git a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn index a8ea2dc7..ad966fc6 100644 --- a/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn +++ b/test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.participant.bpmn @@ -1,7 +1,7 @@ - + From 95b50f08a7446a742ad0694431eade4d8fa62a0d Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Thu, 26 Mar 2020 21:11:54 +0100 Subject: [PATCH 06/27] feat(replace): create bpmn:LinkEventDefinition with empty name Closes https://github.com/bpmn-io/bpmn-js/issues/1296 --- lib/features/modeling/ElementFactory.js | 2 +- lib/features/replace/BpmnReplace.js | 1 + lib/features/replace/ReplaceOptions.js | 10 +++++-- .../features/modeling/ElementFactorySpec.js | 28 +++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lib/features/modeling/ElementFactory.js b/lib/features/modeling/ElementFactory.js index 8f310cf5..d40fcaed 100644 --- a/lib/features/modeling/ElementFactory.js +++ b/lib/features/modeling/ElementFactory.js @@ -117,7 +117,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) { if (attrs.eventDefinitionType) { eventDefinitions = businessObject.get('eventDefinitions') || []; - newEventDefinition = this._bpmnFactory.create(attrs.eventDefinitionType); + newEventDefinition = this._bpmnFactory.create(attrs.eventDefinitionType, attrs.eventDefinitionAttrs); if (attrs.eventDefinitionType === 'bpmn:ConditionalEventDefinition') { newEventDefinition.condition = this._bpmnFactory.create('bpmn:FormalExpression'); diff --git a/lib/features/replace/BpmnReplace.js b/lib/features/replace/BpmnReplace.js index da750921..5547d467 100644 --- a/lib/features/replace/BpmnReplace.js +++ b/lib/features/replace/BpmnReplace.js @@ -173,6 +173,7 @@ export default function BpmnReplace( // i.e. because we copied it if (!hasEventDefinition(newBusinessObject, target.eventDefinitionType)) { newElement.eventDefinitionType = target.eventDefinitionType; + newElement.eventDefinitionAttrs = target.eventDefinitionAttrs; } } diff --git a/lib/features/replace/ReplaceOptions.js b/lib/features/replace/ReplaceOptions.js index 04cb6ab2..07bd2772 100644 --- a/lib/features/replace/ReplaceOptions.js +++ b/lib/features/replace/ReplaceOptions.js @@ -137,7 +137,10 @@ export var INTERMEDIATE_EVENT = [ className: 'bpmn-icon-intermediate-event-catch-link', target: { type: 'bpmn:IntermediateCatchEvent', - eventDefinitionType: 'bpmn:LinkEventDefinition' + eventDefinitionType: 'bpmn:LinkEventDefinition', + eventDefinitionAttrs: { + name: '' + } } }, { @@ -146,7 +149,10 @@ export var INTERMEDIATE_EVENT = [ className: 'bpmn-icon-intermediate-event-throw-link', target: { type: 'bpmn:IntermediateThrowEvent', - eventDefinitionType: 'bpmn:LinkEventDefinition' + eventDefinitionType: 'bpmn:LinkEventDefinition', + eventDefinitionAttrs: { + name: '' + } } }, { diff --git a/test/spec/features/modeling/ElementFactorySpec.js b/test/spec/features/modeling/ElementFactorySpec.js index f69c96fe..5d2a9bbb 100644 --- a/test/spec/features/modeling/ElementFactorySpec.js +++ b/test/spec/features/modeling/ElementFactorySpec.js @@ -73,6 +73,34 @@ describe('features - element factory', function() { })); + it('should create with link event definition', inject(function(elementFactory) { + + // when + var intermediateThrowEvent = elementFactory.createShape({ + type: 'bpmn:IntermediateThrowEvent', + eventDefinitionType: 'bpmn:LinkEventDefinition', + eventDefinitionAttrs: { + name: '' + } + }); + + // then + expect(intermediateThrowEvent).to.exist; + expect(is(intermediateThrowEvent, 'bpmn:IntermediateThrowEvent')).to.be.true; + + var intermediateThrowEventBo = getBusinessObject(intermediateThrowEvent), + eventDefinitions = intermediateThrowEventBo.eventDefinitions; + + expect(eventDefinitions).to.exist; + expect(eventDefinitions).to.have.length(1); + + var eventDefinition = eventDefinitions[ 0 ]; + + expect(is(eventDefinition, 'bpmn:LinkEventDefinition')).to.be.true; + expect(eventDefinition.name).to.eql(''); + })); + + describe('integration', function() { it('should create event definition with ID', inject(function(elementFactory) { From c2ded3952f98f6aa916a3b7078dc9ad12fa255ca Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Fri, 27 Mar 2020 07:57:56 +0100 Subject: [PATCH 07/27] test(popup-menu): verify if linked events have name --- .../ReplaceMenuProvider.events.bpmn | 29 ++++++++ .../popup-menu/ReplaceMenuProviderSpec.js | 68 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 test/spec/features/popup-menu/ReplaceMenuProvider.events.bpmn diff --git a/test/spec/features/popup-menu/ReplaceMenuProvider.events.bpmn b/test/spec/features/popup-menu/ReplaceMenuProvider.events.bpmn new file mode 100644 index 00000000..6e03bcb3 --- /dev/null +++ b/test/spec/features/popup-menu/ReplaceMenuProvider.events.bpmn @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index bd63ca5d..3383248f 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -1750,6 +1750,74 @@ describe('features/popup-menu - replace menu provider', function() { }); + + describe('events', function() { + + var diagramXML = require('./ReplaceMenuProvider.events.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { + modules: testModules + })); + + + it('should set default link name for a link catch event', inject(function(elementRegistry) { + + // given + var event = elementRegistry.get('IntermediateEvent'); + + // when + openPopup(event); + + triggerAction('replace-with-link-intermediate-catch'); + + // then + event = elementRegistry.get('IntermediateEvent'); + + expect(event).to.exist; + expect(is(event, 'bpmn:IntermediateCatchEvent'), 'is not a catch event').to.be.true; + + var eventBo = event.businessObject, + eventDefinitions = eventBo.eventDefinitions; + + expect(eventDefinitions).to.exist; + expect(eventDefinitions).to.have.length(1); + + var eventDefinition = eventDefinitions[ 0 ]; + + expect(is(eventDefinition, 'bpmn:LinkEventDefinition')).to.be.true; + expect(eventDefinition.name, 'name is not set').to.eql(''); + })); + + + it('should set default link name for a link throw event', inject(function(elementRegistry) { + + // given + var event = elementRegistry.get('IntermediateEvent'); + + // when + openPopup(event); + + triggerAction('replace-with-link-intermediate-throw'); + + // then + event = elementRegistry.get('IntermediateEvent'); + + expect(event).to.exist; + expect(is(event, 'bpmn:IntermediateThrowEvent'), 'is not a throw event').to.be.true; + + var eventBo = event.businessObject, + eventDefinitions = eventBo.eventDefinitions; + + expect(eventDefinitions).to.exist; + expect(eventDefinitions).to.have.length(1); + + var eventDefinition = eventDefinitions[ 0 ]; + + expect(is(eventDefinition, 'bpmn:LinkEventDefinition')).to.be.true; + expect(eventDefinition.name, 'name is not set').to.eql(''); + })); + }); + }); From b9d237e300c87b2a61ad02d00d3fdff8c006f1ec Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Fri, 20 Mar 2020 13:21:13 +0100 Subject: [PATCH 08/27] test(modeling): verify re-layout of message flows when lane added Related to #1289 Related to https://github.com/camunda/camunda-modeler/issues/655 --- .../features/modeling/lanes/AddLaneSpec.js | 102 +++++++++++++++--- .../modeling/lanes/lanes-flow-nodes.bpmn | 81 +++++++++----- 2 files changed, 138 insertions(+), 45 deletions(-) diff --git a/test/spec/features/modeling/lanes/AddLaneSpec.js b/test/spec/features/modeling/lanes/AddLaneSpec.js index e5397e51..6c98dfe6 100644 --- a/test/spec/features/modeling/lanes/AddLaneSpec.js +++ b/test/spec/features/modeling/lanes/AddLaneSpec.js @@ -5,6 +5,7 @@ import { } from 'test/TestHelper'; import { + map, pick } from 'min-dash'; @@ -329,19 +330,32 @@ describe('features/modeling - add Lane', function() { }); } + function addLaneBelow(laneId) { + + return getBpmnJS().invoke(function(elementRegistry, modeling) { + var existingLane = elementRegistry.get(laneId); + + expect(existingLane).to.exist; + + return modeling.addLane(existingLane, 'bottom'); + }); + } + it('should move flow nodes', inject(function(elementRegistry, modeling) { // given var task_Boundary = elementRegistry.get('Task_Boundary'), - boundary = elementRegistry.get('Boundary'); + taskPosition = getPosition(task_Boundary), + boundary = elementRegistry.get('Boundary'), + boundaryPosition = getPosition(boundary); // when addLaneAbove('Nested_Lane_B'); // then - expect(task_Boundary).to.have.position({ x: 344, y: -7 }); - expect(boundary).to.have.position({ x: 391, y: 55 }); + expect(task_Boundary).to.have.position({ x: taskPosition.x, y: taskPosition.y - 120 }); + expect(boundary).to.have.position({ x: boundaryPosition.x, y: boundaryPosition.y - 120 }); })); @@ -349,22 +363,54 @@ describe('features/modeling - add Lane', function() { // given var sequenceFlow = elementRegistry.get('SequenceFlow'), - sequenceFlow_From_Boundary = elementRegistry.get('SequenceFlow_From_Boundary'); + sequenceFlowWaypoints = sequenceFlow.waypoints, + sequenceFlow_From_Boundary = elementRegistry.get('SequenceFlow_From_Boundary'), + sequenceFlow_From_BoundaryWaypoints = sequenceFlow_From_Boundary.waypoints; // when addLaneAbove('Nested_Lane_B'); // then - expect(sequenceFlow_From_Boundary).to.have.waypoints([ - { x: 409, y: 91 }, - { x: 409, y: 118 }, - { x: 562, y: 118 }, - { x: 562, y: 73 } - ]); + expect(sequenceFlow_From_Boundary).to.have.waypoints( + moveWaypoints(sequenceFlow_From_BoundaryWaypoints, 0, -120) + ); - expect(sequenceFlow).to.have.waypoints([ - { x: 444, y: 33 }, - { x: 512, y: 33 } + expect(sequenceFlow).to.have.waypoints( + moveWaypoints(sequenceFlowWaypoints, 0, -120) + ); + })); + + + it('should move message flows when lane added above', inject(function(elementRegistry) { + + // given + var messageFlow = elementRegistry.get('MessageFlowAbove'), + messageFlowWaypoints = messageFlow.waypoints; + + // when + addLaneAbove('Nested_Lane_B'); + + // then + expect(messageFlow).to.have.waypoints([ + movePosition(messageFlowWaypoints[0], 0, -120), + messageFlowWaypoints[1] + ]); + })); + + + it('should move message flows when lane added below', inject(function(elementRegistry) { + + // given + var messageFlow = elementRegistry.get('MessageFlowBelow'), + messageFlowWaypoints = messageFlow.waypoints; + + // when + addLaneBelow('Nested_Lane_B'); + + // then + expect(messageFlow).to.have.waypoints([ + messageFlowWaypoints[0], + movePosition(messageFlowWaypoints[1], 0, 120) ]); })); @@ -373,7 +419,8 @@ describe('features/modeling - add Lane', function() { // given var event = elementRegistry.get('Event'), - label = event.label; + label = event.label, + labelPosition = getPosition(label); // TODO(nikku): consolidate import + editing behavior => not consistent right now @@ -384,7 +431,10 @@ describe('features/modeling - add Lane', function() { addLaneAbove('Nested_Lane_B'); // then - expect(label.y).to.eql(58); + expect(label).to.have.position({ + x: labelPosition.x, + y: labelPosition.y - 120 + }); })); }); @@ -447,4 +497,24 @@ function padEvent(entry) { clientY: 100 }; }); -} \ No newline at end of file +} + +function getPosition(element) { + return { + x: element.x, + y: element.y + }; +} + +function moveWaypoints(waypoints, deltaX, deltaY) { + return map(waypoints, function(waypoint) { + return movePosition(waypoint, deltaX, deltaY); + }); +} + +function movePosition(point, deltaX, deltaY) { + return { + x: point.x + deltaX, + y: point.y + deltaY + }; +} diff --git a/test/spec/features/modeling/lanes/lanes-flow-nodes.bpmn b/test/spec/features/modeling/lanes/lanes-flow-nodes.bpmn index dce2514e..85d74419 100644 --- a/test/spec/features/modeling/lanes/lanes-flow-nodes.bpmn +++ b/test/spec/features/modeling/lanes/lanes-flow-nodes.bpmn @@ -1,7 +1,11 @@ - + + + + + @@ -11,13 +15,13 @@ Event Boundary - Task_Boundary Task Event Boundary + @@ -32,57 +36,76 @@ SequenceFlow_From_Boundary - + + + - + - - + + - - - - - + + - - + + - - - - + + + + - - + + - + - - + + - - - - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + From aa584938728becf5c22ea383b43cc2fc84edfb5f Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Fri, 27 Mar 2020 13:57:54 +0100 Subject: [PATCH 09/27] test(modeling): verify attachment is not unnecessarily moved Related to https://github.com/camunda/camunda-modeler/issues/1737 --- test/fixtures/bpmn/boundary-events.bpmn | 53 +++++++++++-------- .../spec/features/modeling/ResizeShapeSpec.js | 33 ++++++++++++ 2 files changed, 63 insertions(+), 23 deletions(-) diff --git a/test/fixtures/bpmn/boundary-events.bpmn b/test/fixtures/bpmn/boundary-events.bpmn index 3502601f..b97c6598 100644 --- a/test/fixtures/bpmn/boundary-events.bpmn +++ b/test/fixtures/bpmn/boundary-events.bpmn @@ -1,5 +1,5 @@ - + @@ -15,43 +15,32 @@ + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - @@ -61,6 +50,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/test/spec/features/modeling/ResizeShapeSpec.js b/test/spec/features/modeling/ResizeShapeSpec.js index d32d8af8..f068f6c9 100644 --- a/test/spec/features/modeling/ResizeShapeSpec.js +++ b/test/spec/features/modeling/ResizeShapeSpec.js @@ -3,6 +3,8 @@ import { inject } from 'test/TestHelper'; +import { pick } from 'min-dash'; + import { getBusinessObject } from 'lib/util/ModelUtil'; @@ -123,4 +125,35 @@ describe('features/modeling - resize shape', function() { }); + + describe('integration', function() { + + var diagramXML = require('../../../fixtures/bpmn/boundary-events.bpmn'); + + var testModules = [ coreModule, modelingModule ]; + + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); + + + it('should not move Boundary Event if unnecessary', inject(function(elementRegistry, modeling) { + + // given + var boundaryEvent = elementRegistry.get('BoundaryEvent_3'), + originalPosition = getPosition(boundaryEvent), + subProcessElement = elementRegistry.get('SubProcess_1'); + + // when + modeling.resizeShape(subProcessElement, { x: 204, y: 28, width: 400, height: 339 }); + + // then + expect(getPosition(boundaryEvent)).to.jsonEqual(originalPosition); + })); + + }); + }); + +// helper ///// +function getPosition(shape) { + return pick(shape, [ 'x', 'y' ]); +} From 3620f3815800009d5eb63b189ff5a067d3d47f1f Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Sat, 4 Apr 2020 09:27:43 +0200 Subject: [PATCH 10/27] chore(project): update diagram-js to v6.5.0 Closes #1289 --- package-lock.json | 15 +++++++++------ package.json | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 573394c5..d683da31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1002,7 +1002,8 @@ }, "kind-of": { "version": "6.0.2", - "resolved": "", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true } } @@ -2025,9 +2026,9 @@ "dev": true }, "diagram-js": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.4.1.tgz", - "integrity": "sha512-VqzydNl6RmnWuHT1B82VId7mH+TG+yZYkgEDp5BizaVDJyhl2F9Z1/q+X9FUQaBq08ZMW1NQP/Bljn56nGHjKw==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.5.0.tgz", + "integrity": "sha512-fayigJnTBrrQpYm4mmoKjo3v3ABkK/gIW1QFPC7CCZrXd/Jx9iC3JdShee1ucT1PSE2I86jRKnT9qdzeQk/ltQ==", "requires": { "css.escape": "^1.5.1", "didi": "^4.0.0", @@ -8280,7 +8281,8 @@ }, "kind-of": { "version": "6.0.2", - "resolved": "", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true } } @@ -9706,7 +9708,8 @@ }, "kind-of": { "version": "6.0.2", - "resolved": "", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, "micromatch": { diff --git a/package.json b/package.json index daf3aa62..da39a583 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "bpmn-font": "^0.9.3", "bpmn-moddle": "^6.0.2", "css.escape": "^1.5.1", - "diagram-js": "^6.4.1", + "diagram-js": "^6.5.0", "diagram-js-direct-editing": "^1.6.1", "ids": "^1.0.0", "inherits": "^2.0.1", From 7a67ff95b2c06669d449f2751233e2aec6c7c61e Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Fri, 3 Apr 2020 15:51:45 +0200 Subject: [PATCH 11/27] chore(documentation): fix JSDoc string types --- lib/BaseModeler.js | 4 ++-- lib/BaseViewer.js | 22 +++++++++---------- lib/Modeler.js | 4 ++-- lib/Viewer.js | 4 ++-- lib/draw/PathMap.js | 2 +- lib/draw/TextRenderer.js | 6 ++--- .../context-pad/ContextPadProvider.js | 6 ++--- lib/features/keyboard/BpmnKeyboardBindings.js | 2 +- .../label-editing/cmd/UpdateLabelHandler.js | 2 +- lib/features/modeling/ElementFactory.js | 4 ++-- .../AdaptiveLabelPositioningBehavior.js | 6 ++--- lib/features/modeling/util/ModelingUtil.js | 4 ++-- lib/features/search/BpmnSearchProvider.js | 4 ++-- lib/import/BpmnTreeWalker.js | 2 +- lib/util/ModelUtil.js | 2 +- test/helper/index.js | 4 ++-- .../custom-elements/CustomElementFactory.js | 2 +- test/spec/draw/BpmnRendererSpec.js | 4 ++-- .../features/copy-paste/BpmnCopyPasteSpec.js | 4 ++-- test/util/KeyEvents.js | 2 +- 20 files changed, 45 insertions(+), 45 deletions(-) diff --git a/lib/BaseModeler.js b/lib/BaseModeler.js index efa727f6..baf318fe 100644 --- a/lib/BaseModeler.js +++ b/lib/BaseModeler.js @@ -12,8 +12,8 @@ import BaseViewer from './BaseViewer'; * * @param {Object} [options] configuration options to pass to the viewer * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body. - * @param {String|Number} [options.width] the width of the viewer - * @param {String|Number} [options.height] the height of the viewer + * @param {string|Number} [options.width] the width of the viewer + * @param {string|Number} [options.height] the height of the viewer * @param {Object} [options.moddleExtensions] extension packages to provide * @param {Array} [options.modules] a list of modules to override the default modules * @param {Array} [options.additionalModules] a list of modules to use with the default modules diff --git a/lib/BaseViewer.js b/lib/BaseViewer.js index cc0f3385..0fc82c4c 100644 --- a/lib/BaseViewer.js +++ b/lib/BaseViewer.js @@ -40,8 +40,8 @@ import { * * @param {Object} [options] configuration options to pass to the viewer * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body. - * @param {String|Number} [options.width] the width of the viewer - * @param {String|Number} [options.height] the height of the viewer + * @param {string|Number} [options.width] the width of the viewer + * @param {string|Number} [options.height] the height of the viewer * @param {Object} [options.moddleExtensions] extension packages to provide * @param {Array} [options.modules] a list of modules to override the default modules * @param {Array} [options.additionalModules] a list of modules to use with the default modules @@ -84,8 +84,8 @@ inherits(BaseViewer, Diagram); * * You can use these events to hook into the life-cycle. * - * @param {String} xml the BPMN 2.0 xml - * @param {ModdleElement|String} [bpmnDiagram] BPMN diagram or id of diagram to render (if not provided, the first one will be rendered) + * @param {string} xml the BPMN 2.0 xml + * @param {ModdleElement|string} [bpmnDiagram] BPMN diagram or id of diagram to render (if not provided, the first one will be rendered) * @param {Function} [done] invoked with (err, warnings=[]) */ BaseViewer.prototype.importXML = function(xml, bpmnDiagram, done) { @@ -150,7 +150,7 @@ BaseViewer.prototype.importXML = function(xml, bpmnDiagram, done) { * You can use these events to hook into the life-cycle. * * @param {ModdleElement} definitions parsed BPMN 2.0 definitions - * @param {ModdleElement|String} [bpmnDiagram] BPMN diagram or id of diagram to render (if not provided, the first one will be rendered) + * @param {ModdleElement|string} [bpmnDiagram] BPMN diagram or id of diagram to render (if not provided, the first one will be rendered) * @param {Function} [done] invoked with (err, warnings=[]) */ BaseViewer.prototype.importDefinitions = function(definitions, bpmnDiagram, done) { @@ -183,7 +183,7 @@ BaseViewer.prototype.importDefinitions = function(definitions, bpmnDiagram, done * * You can use these events to hook into the life-cycle. * - * @param {String|ModdleElement} [bpmnDiagramOrId] id or the diagram to open + * @param {string|ModdleElement} [bpmnDiagramOrId] id or the diagram to open * @param {Function} [done] invoked with (err, warnings=[]) */ BaseViewer.prototype.open = function(bpmnDiagramOrId, done) { @@ -350,7 +350,7 @@ BaseViewer.prototype.saveSVG = function(options, done) { * var elementRegistry = viewer.get('elementRegistry'); * var startEventShape = elementRegistry.get('StartEvent_1'); * - * @param {String} name + * @param {string} name * * @return {Object} diagram service instance * @@ -432,7 +432,7 @@ BaseViewer.prototype.destroy = function() { * * Remove a previously added listener via {@link #off(event, callback)}. * - * @param {String} event + * @param {string} event * @param {Number} [priority] * @param {Function} callback * @param {Object} [that] @@ -444,7 +444,7 @@ BaseViewer.prototype.on = function(event, priority, callback, target) { /** * De-register an event listener * - * @param {String} event + * @param {string} event * @param {Function} callback */ BaseViewer.prototype.off = function(event, callback) { @@ -524,7 +524,7 @@ BaseViewer.prototype._init = function(container, moddle, options) { /** * Emit an event on the underlying {@link EventBus} * - * @param {String} type + * @param {string} type * @param {Object} event * * @return {Object} event processing result (if any) @@ -593,7 +593,7 @@ function ensureUnit(val) { * Find BPMNDiagram in definitions by ID * * @param {ModdleElement} definitions - * @param {String} diagramId + * @param {string} diagramId * * @return {ModdleElement|null} */ diff --git a/lib/Modeler.js b/lib/Modeler.js index c1b57bd7..4225fc1c 100644 --- a/lib/Modeler.js +++ b/lib/Modeler.js @@ -123,8 +123,8 @@ var initialDiagram = * * @param {Object} [options] configuration options to pass to the viewer * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body. - * @param {String|Number} [options.width] the width of the viewer - * @param {String|Number} [options.height] the height of the viewer + * @param {string|Number} [options.width] the width of the viewer + * @param {string|Number} [options.height] the height of the viewer * @param {Object} [options.moddleExtensions] extension packages to provide * @param {Array} [options.modules] a list of modules to override the default modules * @param {Array} [options.additionalModules] a list of modules to use with the default modules diff --git a/lib/Viewer.js b/lib/Viewer.js index 1f57bac3..505479c8 100644 --- a/lib/Viewer.js +++ b/lib/Viewer.js @@ -49,8 +49,8 @@ import BaseViewer from './BaseViewer'; * * @param {Object} [options] configuration options to pass to the viewer * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body. - * @param {String|Number} [options.width] the width of the viewer - * @param {String|Number} [options.height] the height of the viewer + * @param {string|Number} [options.width] the width of the viewer + * @param {string|Number} [options.height] the height of the viewer * @param {Object} [options.moddleExtensions] extension packages to provide * @param {Array} [options.modules] a list of modules to override the default modules * @param {Array} [options.additionalModules] a list of modules to use with the default modules diff --git a/lib/draw/PathMap.js b/lib/draw/PathMap.js index f5d024b7..cc28a48b 100644 --- a/lib/draw/PathMap.js +++ b/lib/draw/PathMap.js @@ -362,7 +362,7 @@ export default function PathMap() { * Also there are use cases where only some parts of a path should be * scaled.

* - * @param {String} pathId The ID of the path. + * @param {string} pathId The ID of the path. * @param {Object} param

* Example param object scales the path to 60% size of the container (data.width, data.height). *

diff --git a/lib/draw/TextRenderer.js b/lib/draw/TextRenderer.js
index 8d1fe0d3..e70b8096 100644
--- a/lib/draw/TextRenderer.js
+++ b/lib/draw/TextRenderer.js
@@ -32,7 +32,7 @@ export default function TextRenderer(config) {
    * layouted label.
    *
    * @param  {Bounds} bounds
-   * @param  {String} text
+   * @param  {string} text
    *
    * @return {Bounds}
    */
@@ -62,7 +62,7 @@ export default function TextRenderer(config) {
    * Get the new bounds of text annotation.
    *
    * @param  {Bounds} bounds
-   * @param  {String} text
+   * @param  {string} text
    *
    * @return {Bounds}
    */
@@ -86,7 +86,7 @@ export default function TextRenderer(config) {
   /**
    * Create a layouted text element.
    *
-   * @param {String} text
+   * @param {string} text
    * @param {Object} [options]
    *
    * @return {SVGElement} rendered text
diff --git a/lib/features/context-pad/ContextPadProvider.js b/lib/features/context-pad/ContextPadProvider.js
index 564435be..3d7ce3cd 100644
--- a/lib/features/context-pad/ContextPadProvider.js
+++ b/lib/features/context-pad/ContextPadProvider.js
@@ -142,9 +142,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
   /**
    * Create an append action
    *
-   * @param {String} type
-   * @param {String} className
-   * @param {String} [title]
+   * @param {string} type
+   * @param {string} className
+   * @param {string} [title]
    * @param {Object} [options]
    *
    * @return {Object} descriptor
diff --git a/lib/features/keyboard/BpmnKeyboardBindings.js b/lib/features/keyboard/BpmnKeyboardBindings.js
index 3531f377..fc940ff7 100644
--- a/lib/features/keyboard/BpmnKeyboardBindings.js
+++ b/lib/features/keyboard/BpmnKeyboardBindings.js
@@ -34,7 +34,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
    * Add keyboard binding if respective editor action
    * is registered.
    *
-   * @param {String} action name
+   * @param {string} action name
    * @param {Function} fn that implements the key binding
    */
   function addListener(action, fn) {
diff --git a/lib/features/label-editing/cmd/UpdateLabelHandler.js b/lib/features/label-editing/cmd/UpdateLabelHandler.js
index 63678b93..0c4e44ee 100644
--- a/lib/features/label-editing/cmd/UpdateLabelHandler.js
+++ b/lib/features/label-editing/cmd/UpdateLabelHandler.js
@@ -31,7 +31,7 @@ export default function UpdateLabelHandler(modeling, textRenderer) {
    * Element parameter can be label itself or connection (i.e. sequence flow).
    *
    * @param {djs.model.Base} element
-   * @param {String} text
+   * @param {string} text
    */
   function setText(element, text) {
 
diff --git a/lib/features/modeling/ElementFactory.js b/lib/features/modeling/ElementFactory.js
index d40fcaed..24a8f695 100644
--- a/lib/features/modeling/ElementFactory.js
+++ b/lib/features/modeling/ElementFactory.js
@@ -229,7 +229,7 @@ ElementFactory.prototype.createParticipantShape = function(attrs) {
  *
  * @param {Base} element
  * @param {Object} attrs (in/out map of attributes)
- * @param {Array} attributeNames name of attributes to apply
+ * @param {Array} attributeNames name of attributes to apply
  */
 function applyAttributes(element, attrs, attributeNames) {
 
@@ -246,7 +246,7 @@ function applyAttributes(element, attrs, attributeNames) {
  *
  * @param {Base} element
  * @param {Object} attrs (in/out map of attributes)
- * @param {String} attributeName to apply
+ * @param {string} attributeName to apply
  */
 function applyAttribute(element, attrs, attributeName) {
   element[attributeName] = attrs[attributeName];
diff --git a/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js b/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js
index 88df818c..b56820db 100644
--- a/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js
+++ b/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js
@@ -173,7 +173,7 @@ AdaptiveLabelPositioningBehavior.$inject = [
  *
  * @param {Shape} element
  *
- * @return {Array}
+ * @return {Array}
  */
 function getTakenHostAlignments(element) {
 
@@ -204,7 +204,7 @@ function getTakenHostAlignments(element) {
  *
  * @param {Shape} element
  *
- * @return {Array}
+ * @return {Array}
  */
 function getTakenConnectionAlignments(element) {
 
@@ -230,7 +230,7 @@ function getTakenConnectionAlignments(element) {
  *
  * @param  {Shape} element
  *
- * @return {String} positioning identifier
+ * @return {string} positioning identifier
  */
 function getOptimalPosition(element) {
 
diff --git a/lib/features/modeling/util/ModelingUtil.js b/lib/features/modeling/util/ModelingUtil.js
index 871c777c..27237050 100644
--- a/lib/features/modeling/util/ModelingUtil.js
+++ b/lib/features/modeling/util/ModelingUtil.js
@@ -9,7 +9,7 @@ import { is } from '../../../util/ModelUtil';
  * Return true if element has any of the given types.
  *
  * @param {djs.model.Base} element
- * @param {Array} types
+ * @param {Array} types
  *
  * @return {Boolean}
  */
@@ -24,7 +24,7 @@ export function isAny(element, types) {
  * Return the parent of the element with any of the given types.
  *
  * @param {djs.model.Base} element
- * @param {String|Array} anyType
+ * @param {string|Array} anyType
  *
  * @return {djs.model.Base}
  */
diff --git a/lib/features/search/BpmnSearchProvider.js b/lib/features/search/BpmnSearchProvider.js
index 0f8f351d..d606f1a2 100644
--- a/lib/features/search/BpmnSearchProvider.js
+++ b/lib/features/search/BpmnSearchProvider.js
@@ -39,10 +39,10 @@ BpmnSearchProvider.$inject = [
  *
  *  :
  *  {
- *    normal|matched: 
+ *    normal|matched: 
  *  }
  *
- * @param  {String} pattern
+ * @param  {string} pattern
  * @return {Array}
  */
 BpmnSearchProvider.prototype.find = function(pattern) {
diff --git a/lib/import/BpmnTreeWalker.js b/lib/import/BpmnTreeWalker.js
index eaee6061..e897d9b8 100644
--- a/lib/import/BpmnTreeWalker.js
+++ b/lib/import/BpmnTreeWalker.js
@@ -19,7 +19,7 @@ var diRefs = new Refs(
  * Returns true if an element has the given meta-model type
  *
  * @param  {ModdleElement}  element
- * @param  {String}         type
+ * @param  {string}         type
  *
  * @return {Boolean}
  */
diff --git a/lib/util/ModelUtil.js b/lib/util/ModelUtil.js
index e45af72a..3a0a7773 100644
--- a/lib/util/ModelUtil.js
+++ b/lib/util/ModelUtil.js
@@ -2,7 +2,7 @@
  * Is an element of the given BPMN type?
  *
  * @param  {djs.model.Base|ModdleElement} element
- * @param  {String} type
+ * @param  {string} type
  *
  * @return {Boolean}
  */
diff --git a/test/helper/index.js b/test/helper/index.js
index 58902959..10bfdd8d 100644
--- a/test/helper/index.js
+++ b/test/helper/index.js
@@ -142,7 +142,7 @@ export function bootstrapBpmnJS(BpmnJS, diagram, options, locals) {
  *
  * });
  *
- * @param  {String} xml document to display
+ * @param  {string} xml document to display
  * @param  {Object} (options) optional options to be passed to the diagram upon instantiation
  * @param  {Object|Function} locals  the local overrides to be used by the diagram or a function that produces them
  * @return {Function}         a function to be passed to beforeEach
@@ -170,7 +170,7 @@ export function bootstrapModeler(diagram, options, locals) {
  *
  * });
  *
- * @param  {String} xml document to display
+ * @param  {string} xml document to display
  * @param  {Object} (options) optional options to be passed to the diagram upon instantiation
  * @param  {Object|Function} locals  the local overrides to be used by the diagram or a function that produces them
  * @return {Function}         a function to be passed to beforeEach
diff --git a/test/integration/custom-elements/CustomElementFactory.js b/test/integration/custom-elements/CustomElementFactory.js
index 5d42b9f9..c31ceacf 100644
--- a/test/integration/custom-elements/CustomElementFactory.js
+++ b/test/integration/custom-elements/CustomElementFactory.js
@@ -61,7 +61,7 @@ CustomElementFactory.$inject = [ 'injector' ];
  *   return shapes[type];
  *
  *
- * @param  {String} type
+ * @param  {string} type
  *
  * @return {Bounds} { width, height}
  */
diff --git a/test/spec/draw/BpmnRendererSpec.js b/test/spec/draw/BpmnRendererSpec.js
index 46d50c25..535fb9e9 100644
--- a/test/spec/draw/BpmnRendererSpec.js
+++ b/test/spec/draw/BpmnRendererSpec.js
@@ -416,8 +416,8 @@ describe('draw - bpmn renderer', function() {
        *
        * @param {djs.model.base} element - Element.
        * @param {SVG} gfx - Graphics of element.
-       * @param {String} fillColor - Fill color to expect.
-       * @param {String} strokeColor - Stroke color to expect.
+       * @param {string} fillColor - Fill color to expect.
+       * @param {string} strokeColor - Stroke color to expect.
        */
       function expectColors(element, gfx, fillColor, strokeColor) {
         var djsVisual = domQuery('.djs-visual', gfx);
diff --git a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js
index 0fe2f3fd..2d3e96d1 100644
--- a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js
+++ b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js
@@ -834,7 +834,7 @@ describe('features/copy-paste', function() {
 /**
  * Integration test involving copying, pasting, moving, undoing and redoing.
  *
- * @param {String|Array} elementIds
+ * @param {string|Array} elementIds
  */
 function integrationTest(elementIds) {
   if (!isArray(elementIds)) {
@@ -1000,7 +1000,7 @@ function _findDescriptorsInTree(elements, tree, depth) {
 /**
  * Copy elements.
  *
- * @param {Array
Date: Mon, 6 Apr 2020 10:25:03 +0200
Subject: [PATCH 12/27] chore(documentation): fix JSDoc number types

---
 lib/BaseModeler.js                                        | 4 ++--
 lib/BaseViewer.js                                         | 6 +++---
 lib/Modeler.js                                            | 4 ++--
 lib/Viewer.js                                             | 4 ++--
 lib/features/auto-place/AutoPlaceUtil.js                  | 2 +-
 lib/features/modeling/behavior/util/LineAttachmentUtil.js | 8 ++++----
 test/util/KeyEvents.js                                    | 2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/BaseModeler.js b/lib/BaseModeler.js
index baf318fe..7c6ac913 100644
--- a/lib/BaseModeler.js
+++ b/lib/BaseModeler.js
@@ -12,8 +12,8 @@ import BaseViewer from './BaseViewer';
  *
  * @param {Object} [options] configuration options to pass to the viewer
  * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.
- * @param {string|Number} [options.width] the width of the viewer
- * @param {string|Number} [options.height] the height of the viewer
+ * @param {string|number} [options.width] the width of the viewer
+ * @param {string|number} [options.height] the height of the viewer
  * @param {Object} [options.moddleExtensions] extension packages to provide
  * @param {Array} [options.modules] a list of modules to override the default modules
  * @param {Array} [options.additionalModules] a list of modules to use with the default modules
diff --git a/lib/BaseViewer.js b/lib/BaseViewer.js
index 0fc82c4c..0b86b96b 100644
--- a/lib/BaseViewer.js
+++ b/lib/BaseViewer.js
@@ -40,8 +40,8 @@ import {
  *
  * @param {Object} [options] configuration options to pass to the viewer
  * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.
- * @param {string|Number} [options.width] the width of the viewer
- * @param {string|Number} [options.height] the height of the viewer
+ * @param {string|number} [options.width] the width of the viewer
+ * @param {string|number} [options.height] the height of the viewer
  * @param {Object} [options.moddleExtensions] extension packages to provide
  * @param {Array} [options.modules] a list of modules to override the default modules
  * @param {Array} [options.additionalModules] a list of modules to use with the default modules
@@ -433,7 +433,7 @@ BaseViewer.prototype.destroy = function() {
  * Remove a previously added listener via {@link #off(event, callback)}.
  *
  * @param {string} event
- * @param {Number} [priority]
+ * @param {number} [priority]
  * @param {Function} callback
  * @param {Object} [that]
  */
diff --git a/lib/Modeler.js b/lib/Modeler.js
index 4225fc1c..94d17e0f 100644
--- a/lib/Modeler.js
+++ b/lib/Modeler.js
@@ -123,8 +123,8 @@ var initialDiagram =
  *
  * @param {Object} [options] configuration options to pass to the viewer
  * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.
- * @param {string|Number} [options.width] the width of the viewer
- * @param {string|Number} [options.height] the height of the viewer
+ * @param {string|number} [options.width] the width of the viewer
+ * @param {string|number} [options.height] the height of the viewer
  * @param {Object} [options.moddleExtensions] extension packages to provide
  * @param {Array} [options.modules] a list of modules to override the default modules
  * @param {Array} [options.additionalModules] a list of modules to use with the default modules
diff --git a/lib/Viewer.js b/lib/Viewer.js
index 505479c8..217887e4 100644
--- a/lib/Viewer.js
+++ b/lib/Viewer.js
@@ -49,8 +49,8 @@ import BaseViewer from './BaseViewer';
  *
  * @param {Object} [options] configuration options to pass to the viewer
  * @param {DOMElement} [options.container] the container to render the viewer in, defaults to body.
- * @param {string|Number} [options.width] the width of the viewer
- * @param {string|Number} [options.height] the height of the viewer
+ * @param {string|number} [options.width] the width of the viewer
+ * @param {string|number} [options.height] the height of the viewer
  * @param {Object} [options.moddleExtensions] extension packages to provide
  * @param {Array} [options.modules] a list of modules to override the default modules
  * @param {Array} [options.additionalModules] a list of modules to use with the default modules
diff --git a/lib/features/auto-place/AutoPlaceUtil.js b/lib/features/auto-place/AutoPlaceUtil.js
index afa8797e..bee66ef6 100644
--- a/lib/features/auto-place/AutoPlaceUtil.js
+++ b/lib/features/auto-place/AutoPlaceUtil.js
@@ -101,7 +101,7 @@ export function getFlowNodePosition(source, element) {
  * @param {djs.model.Shape} source
  * @param {djs.model.Shape} element
  *
- * @return {Number} distance
+ * @return {number} distance
  */
 export function getFlowNodeDistance(source, element) {
 
diff --git a/lib/features/modeling/behavior/util/LineAttachmentUtil.js b/lib/features/modeling/behavior/util/LineAttachmentUtil.js
index ac6acc69..da90b8fa 100644
--- a/lib/features/modeling/behavior/util/LineAttachmentUtil.js
+++ b/lib/features/modeling/behavior/util/LineAttachmentUtil.js
@@ -6,9 +6,9 @@ var sqrt = Math.sqrt,
 /**
  * Calculate the square (power to two) of a number.
  *
- * @param {Number} n
+ * @param {number} n
  *
- * @return {Number}
+ * @return {number}
  */
 function sq(n) {
   return Math.pow(n, 2);
@@ -20,7 +20,7 @@ function sq(n) {
  * @param {Point} p1
  * @param {Point} p2
  *
- * @return {Number}
+ * @return {number}
  */
 function getDistance(p1, p2) {
   return sqrt(sq(p1.x - p2.x) + sq(p1.y - p2.y));
@@ -127,7 +127,7 @@ export function getAttachment(point, line) {
  * @param {Point} s1 segment start
  * @param {Point} s2 segment end
  * @param {Point} cc circle center
- * @param {Number} cr circle radius
+ * @param {number} cr circle radius
  *
  * @return {Array} intersections
  */
diff --git a/test/util/KeyEvents.js b/test/util/KeyEvents.js
index d9de2d4a..dfc0ceee 100644
--- a/test/util/KeyEvents.js
+++ b/test/util/KeyEvents.js
@@ -6,7 +6,7 @@ import {
 /**
  * Create a fake key event for testing purposes.
  *
- * @param {string|Number} key the key or keyCode/charCode
+ * @param {string|number} key the key or keyCode/charCode
  * @param {Object} [attrs]
  *
  * @return {Event}

From 2dd1e1330509d3f6db7939ad8ae22b75144396bd Mon Sep 17 00:00:00 2001
From: Philipp Fromme 
Date: Mon, 6 Apr 2020 10:26:04 +0200
Subject: [PATCH 13/27] chore(documentation): fix JSDoc boolean types

---
 lib/BaseViewer.js                               | 4 ++--
 lib/features/modeling/behavior/GroupBehavior.js | 2 +-
 lib/features/modeling/util/ModelingUtil.js      | 2 +-
 lib/features/popup-menu/util/TypeUtil.js        | 2 +-
 lib/features/rules/BpmnRules.js                 | 4 ++--
 lib/import/BpmnTreeWalker.js                    | 2 +-
 lib/util/LabelUtil.js                           | 4 ++--
 lib/util/ModelUtil.js                           | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/BaseViewer.js b/lib/BaseViewer.js
index 0b86b96b..4977e528 100644
--- a/lib/BaseViewer.js
+++ b/lib/BaseViewer.js
@@ -238,8 +238,8 @@ BaseViewer.prototype.open = function(bpmnDiagramOrId, done) {
  * You can use these events to hook into the life-cycle.
  *
  * @param {Object} [options] export options
- * @param {Boolean} [options.format=false] output formatted XML
- * @param {Boolean} [options.preamble=true] output preamble
+ * @param {boolean} [options.format=false] output formatted XML
+ * @param {boolean} [options.preamble=true] output preamble
  *
  * @param {Function} done invoked with (err, xml)
  */
diff --git a/lib/features/modeling/behavior/GroupBehavior.js b/lib/features/modeling/behavior/GroupBehavior.js
index 6a50c2f2..2cba2453 100644
--- a/lib/features/modeling/behavior/GroupBehavior.js
+++ b/lib/features/modeling/behavior/GroupBehavior.js
@@ -100,7 +100,7 @@ export default function GroupBehavior(
    *
    * @param {Array} elements
    * @param {ModdleElement} categoryValue
-   * @return {Boolean}
+   * @return {boolean}
    */
   function isReferenced(elements, categoryValue) {
     return elements.some(function(e) {
diff --git a/lib/features/modeling/util/ModelingUtil.js b/lib/features/modeling/util/ModelingUtil.js
index 27237050..92d14780 100644
--- a/lib/features/modeling/util/ModelingUtil.js
+++ b/lib/features/modeling/util/ModelingUtil.js
@@ -11,7 +11,7 @@ import { is } from '../../../util/ModelUtil';
  * @param {djs.model.Base} element
  * @param {Array} types
  *
- * @return {Boolean}
+ * @return {boolean}
  */
 export function isAny(element, types) {
   return some(types, function(t) {
diff --git a/lib/features/popup-menu/util/TypeUtil.js b/lib/features/popup-menu/util/TypeUtil.js
index 431558d3..3f65d89e 100644
--- a/lib/features/popup-menu/util/TypeUtil.js
+++ b/lib/features/popup-menu/util/TypeUtil.js
@@ -14,7 +14,7 @@ import {
  *
  * @param {djs.model.Base} element
  *
- * @return {Boolean}
+ * @return {boolean}
  */
 export function isDifferentType(element) {
 
diff --git a/lib/features/rules/BpmnRules.js b/lib/features/rules/BpmnRules.js
index bd318c37..bbf222a8 100644
--- a/lib/features/rules/BpmnRules.js
+++ b/lib/features/rules/BpmnRules.js
@@ -201,7 +201,7 @@ BpmnRules.prototype.canCopy = canCopy;
  * Checks if given element can be used for starting connection.
  *
  * @param  {Element} source
- * @return {Boolean}
+ * @return {boolean}
  */
 function canStartConnection(element) {
   if (nonExistingOrLabel(element)) {
@@ -435,7 +435,7 @@ function canConnect(source, target, connection) {
 /**
  * Can an element be dropped into the target element
  *
- * @return {Boolean}
+ * @return {boolean}
  */
 function canDrop(element, target, position) {
 
diff --git a/lib/import/BpmnTreeWalker.js b/lib/import/BpmnTreeWalker.js
index e897d9b8..2b2342b3 100644
--- a/lib/import/BpmnTreeWalker.js
+++ b/lib/import/BpmnTreeWalker.js
@@ -21,7 +21,7 @@ var diRefs = new Refs(
  * @param  {ModdleElement}  element
  * @param  {string}         type
  *
- * @return {Boolean}
+ * @return {boolean}
  */
 function is(element, type) {
   return element.$instanceOf(type);
diff --git a/lib/util/LabelUtil.js b/lib/util/LabelUtil.js
index 5c6513bf..e23a633d 100644
--- a/lib/util/LabelUtil.js
+++ b/lib/util/LabelUtil.js
@@ -17,7 +17,7 @@ export var FLOW_LABEL_INDENT = 15;
  * Returns true if the given semantic has an external label
  *
  * @param {BpmnElement} semantic
- * @return {Boolean} true if has label
+ * @return {boolean} true if has label
  */
 export function isLabelExternal(semantic) {
   return is(semantic, 'bpmn:Event') ||
@@ -35,7 +35,7 @@ export function isLabelExternal(semantic) {
  * Returns true if the given element has an external label
  *
  * @param {djs.model.shape} element
- * @return {Boolean} true if has label
+ * @return {boolean} true if has label
  */
 export function hasExternalLabel(element) {
   return isLabel(element.label);
diff --git a/lib/util/ModelUtil.js b/lib/util/ModelUtil.js
index 3a0a7773..d4506f8a 100644
--- a/lib/util/ModelUtil.js
+++ b/lib/util/ModelUtil.js
@@ -4,7 +4,7 @@
  * @param  {djs.model.Base|ModdleElement} element
  * @param  {string} type
  *
- * @return {Boolean}
+ * @return {boolean}
  */
 export function is(element, type) {
   var bo = getBusinessObject(element);

From f1745547f08e3ab40202d0178628828af3d36360 Mon Sep 17 00:00:00 2001
From: Maciej Barelkowski 
Date: Wed, 8 Apr 2020 11:37:53 +0200
Subject: [PATCH 14/27] feat(layouter): prefer straight layout for sub-process
 connections

Related to https://github.com/camunda/camunda-modeler/issues/1758
---
 lib/features/modeling/BpmnLayouter.js         |  13 ++
 .../modeling/layout/LayoutSequenceFlowSpec.js | 115 ++++++++++++++++++
 .../LayoutSequenceFlowSpec.subProcess.bpmn    |  25 ++++
 3 files changed, 153 insertions(+)
 create mode 100644 test/spec/features/modeling/layout/LayoutSequenceFlowSpec.subProcess.bpmn

diff --git a/lib/features/modeling/BpmnLayouter.js b/lib/features/modeling/BpmnLayouter.js
index c629d0b0..9cbbb78c 100644
--- a/lib/features/modeling/BpmnLayouter.js
+++ b/lib/features/modeling/BpmnLayouter.js
@@ -98,6 +98,8 @@ BpmnLayouter.prototype.layoutConnection = function(connection, hints) {
       manhattanOptions = {
         preferredLayouts: getBoundaryEventPreferredLayouts(source, target, connectionEnd)
       };
+    } else if (isExpandedSubProcess(source) || isExpandedSubProcess(target)) {
+      manhattanOptions = getSubProcessManhattanOptions(source);
     } else if (is(source, 'bpmn:Gateway')) {
       manhattanOptions = {
         preferredLayouts: [ 'v:h' ]
@@ -177,6 +179,17 @@ function getMessageFlowPreserveDocking(source, target) {
   return null;
 }
 
+function getSubProcessManhattanOptions(source) {
+  return {
+    preferredLayouts: [ 'straight', 'h:h' ],
+    preserveDocking: getSubProcessPreserveDocking(source)
+  };
+}
+
+function getSubProcessPreserveDocking(source) {
+  return isExpandedSubProcess(source) ? 'target' : 'source';
+}
+
 function getConnectionDocking(point, shape) {
   return point ? (point.original || point) : getMid(shape);
 }
diff --git a/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js b/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js
index 07fed5c1..c2f4f1e7 100644
--- a/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js
+++ b/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js
@@ -552,4 +552,119 @@ describe('features/modeling - layout', function() {
 
   });
 
+
+  describe('subProcess', function() {
+
+    var diagramXML = require('./LayoutSequenceFlowSpec.subProcess.bpmn');
+
+    var testModules = [ coreModule, modelingModule ];
+
+    beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
+
+
+    it('should layout straight between subProcesses (top -> bottom)', function() {
+
+      // when
+      var connection = connect('SubProcess_Center', 'SubProcess_Bottom'),
+          source = connection.source,
+          target = connection.target;
+
+      var expectedX = getMid(target).x;
+
+      // then
+      expect(connection).to.have.waypoints([
+        { x: expectedX, y: source.y + source.height },
+        { x: expectedX, y: target.y }
+      ]);
+    });
+
+
+    it('should layout straight between subProcesses (bottom -> top)', function() {
+
+      // when
+      var connection = connect('SubProcess_Bottom', 'SubProcess_Center'),
+          source = connection.source,
+          target = connection.target;
+
+      var expectedX = getMid(target).x;
+
+      // then
+      expect(connection).to.have.waypoints([
+        { x: expectedX, y: source.y },
+        { x: expectedX, y: target.y + target.height }
+      ]);
+    });
+
+
+    it('should layout straight between subProcess and task next to it (subProcess -> task)',
+      function() {
+
+        // when
+        var connection = connect('SubProcess_Center', 'Task_Right'),
+            source = connection.source,
+            target = connection.target;
+
+        var expectedY = getMid(target).y;
+
+        // then
+        expect(connection).to.have.waypoints([
+          { x: source.x + source.width, y: expectedY },
+          { x: target.x, y: expectedY }
+        ]);
+      }
+    );
+
+
+    it('should layout straight between subProcess and task next to it (task -> subProcess)',
+      function() {
+
+        // when
+        var connection = connect('Task_Right', 'SubProcess_Center'),
+            source = connection.source,
+            target = connection.target;
+
+        var expectedY = getMid(source).y;
+
+        // then
+        expect(connection).to.have.waypoints([
+          { x: source.x, y: expectedY },
+          { x: target.x + target.width, y: expectedY }
+        ]);
+      }
+    );
+
+
+    it('should layout straight between subProcess and task above (subProcess -> task)', function() {
+
+      // when
+      var connection = connect('SubProcess_Center', 'Task_Top'),
+          source = connection.source,
+          target = connection.target;
+
+      var expectedX = getMid(target).x;
+
+      // then
+      expect(connection).to.have.waypoints([
+        { x: expectedX, y: source.y },
+        { x: expectedX, y: target.y + target.height }
+      ]);
+    });
+
+
+    it('should layout straight between subProcess and task above (task -> subProcess)', function() {
+
+      // when
+      var connection = connect('Task_Top', 'SubProcess_Center'),
+          source = connection.source,
+          target = connection.target;
+
+      var expectedX = getMid(source).x;
+
+      // then
+      expect(connection).to.have.waypoints([
+        { x: expectedX, y: source.y + source.height },
+        { x: expectedX, y: target.y }
+      ]);
+    });
+  });
 });
diff --git a/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.subProcess.bpmn b/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.subProcess.bpmn
new file mode 100644
index 00000000..0b1a6edc
--- /dev/null
+++ b/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.subProcess.bpmn
@@ -0,0 +1,25 @@
+
+
+  
+    
+    
+    
+    
+  
+  
+    
+      
+        
+      
+      
+        
+      
+      
+        
+      
+      
+        
+      
+    
+  
+

From dd543300bd39349afb2abfa21678244c47dd55a1 Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Wed, 1 Apr 2020 21:18:41 +0200
Subject: [PATCH 15/27] chore(CHANGELOG): update to v6.4.1

---
 CHANGELOG.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 938a1a77..5e81c1be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@ All notable changes to [bpmn-js](https://github.com/bpmn-io/bpmn-js) are documen
 
 ___Note:__ Yet to be released changes appear here._
 
+## 6.4.1
+
+* `FIX`: parse `>` in attribute names
+* `CHORE`: bump to `bpmn-moddle@6.0.3`
+
 ## 6.4.0
 
 * `FEAT`: serialize link events with an empty name ([#1296](https://github.com/bpmn-io/bpmn-js/issues/1296))

From 008ac423efa3ee59999a984df05fd8b3602ba2ef Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Wed, 1 Apr 2020 21:19:13 +0200
Subject: [PATCH 16/27] chore(project): bump to bpmn-moddle@6.0.3

---
 package-lock.json | 22 +++++++++++-----------
 package.json      |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index d683da31..4384fa3a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1106,13 +1106,13 @@
       "integrity": "sha512-kzRGXGLzTROLRNCSskkOyj/+SbtTAn2unKfgB9tNt7RWJFybg/Wbe9YjK2ALotI3b64wwlCTkAalXiTiskP6dg=="
     },
     "bpmn-moddle": {
-      "version": "6.0.2",
-      "resolved": "https://registry.npmjs.org/bpmn-moddle/-/bpmn-moddle-6.0.2.tgz",
-      "integrity": "sha512-RIazADF2YHZhVIXeWT5z6kNo2/uiFXNtb1iqiF51CvHoFJQR2Tj+znEtzHFjJQ1bLSHe7cAO82HEFmovzhiZ9w==",
+      "version": "6.0.3",
+      "resolved": "https://registry.npmjs.org/bpmn-moddle/-/bpmn-moddle-6.0.3.tgz",
+      "integrity": "sha512-KqAzJYotlZF57HNPAH6zyn9VxbRO38J/v4wr1QJ96QDnzzOFxGdFoBCToIaJ5vj/zm0lu+SJwdQgF0EJeo7jxA==",
       "requires": {
         "min-dash": "^3.0.0",
         "moddle": "^5.0.1",
-        "moddle-xml": "^8.0.2"
+        "moddle-xml": "^8.0.3"
       }
     },
     "brace-expansion": {
@@ -5836,13 +5836,13 @@
       }
     },
     "moddle-xml": {
-      "version": "8.0.2",
-      "resolved": "https://registry.npmjs.org/moddle-xml/-/moddle-xml-8.0.2.tgz",
-      "integrity": "sha512-8PkPzoPs8/pz3waSL1EEE0Wm0C7jkHOPVt/GmWhdDJNiz2IlGcCBWBwgb32VcNoN7zAAMvRn0nJ9AyIdOchxIQ==",
+      "version": "8.0.3",
+      "resolved": "https://registry.npmjs.org/moddle-xml/-/moddle-xml-8.0.3.tgz",
+      "integrity": "sha512-sdN5rhNDnOWIC9j1piRgf0Trhz5oU5eh/pDqY5b1WumcLovl6ZBUIvZ1EBXc8bXQutbBOujAX2BM9+iUwTA+HA==",
       "requires": {
         "min-dash": "^3.0.0",
         "moddle": "^5.0.1",
-        "saxen": "^8.1.0"
+        "saxen": "^8.1.1"
       }
     },
     "moment": {
@@ -8010,9 +8010,9 @@
       "dev": true
     },
     "saxen": {
-      "version": "8.1.0",
-      "resolved": "https://registry.npmjs.org/saxen/-/saxen-8.1.0.tgz",
-      "integrity": "sha512-34U5SdDUxECB5Jkwbc2mAdxHyGvbfCHv0iHgf+x2jaYLlwsPpju9651Lld9CpFpF4zJsoWcF3Q05blXXNOb/cg=="
+      "version": "8.1.1",
+      "resolved": "https://registry.npmjs.org/saxen/-/saxen-8.1.1.tgz",
+      "integrity": "sha512-V56ToYbmrCtAPHcuh7ZqCohs5vrMdRXFhxl7tI6KhVxWNB2HLduYgcrS9xeMe4YE5SsvuKy8nBYL3cg2M+nIPA=="
     },
     "schema-utils": {
       "version": "0.3.0",
diff --git a/package.json b/package.json
index da39a583..705dfabf 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
   },
   "dependencies": {
     "bpmn-font": "^0.9.3",
-    "bpmn-moddle": "^6.0.2",
+    "bpmn-moddle": "^6.0.3",
     "css.escape": "^1.5.1",
     "diagram-js": "^6.5.0",
     "diagram-js-direct-editing": "^1.6.1",

From 36b2630adcb56e3f9f45d955879b911e8fc643fb Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Wed, 1 Apr 2020 21:33:52 +0200
Subject: [PATCH 17/27] test(fixtures): correct broken diagram

bpmn-moddle@6.0.3 is stricter during import
---
 .../bpmn/import/data-store.outside-participant.dangling.bpmn    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/fixtures/bpmn/import/data-store.outside-participant.dangling.bpmn b/test/fixtures/bpmn/import/data-store.outside-participant.dangling.bpmn
index 875cf59d..0a28bf7a 100644
--- a/test/fixtures/bpmn/import/data-store.outside-participant.dangling.bpmn
+++ b/test/fixtures/bpmn/import/data-store.outside-participant.dangling.bpmn
@@ -6,7 +6,7 @@
   
   
     
-        >
+        
     
     
   

From 85461c8dbb46203b8b302cdd16772556e3ef771a Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Wed, 8 Apr 2020 10:42:51 +0200
Subject: [PATCH 18/27] chore(project): bump to bpmn-moddle@6.0.4

---
 package-lock.json | 22 +++++++++++-----------
 package.json      |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 4384fa3a..424fceec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1106,13 +1106,13 @@
       "integrity": "sha512-kzRGXGLzTROLRNCSskkOyj/+SbtTAn2unKfgB9tNt7RWJFybg/Wbe9YjK2ALotI3b64wwlCTkAalXiTiskP6dg=="
     },
     "bpmn-moddle": {
-      "version": "6.0.3",
-      "resolved": "https://registry.npmjs.org/bpmn-moddle/-/bpmn-moddle-6.0.3.tgz",
-      "integrity": "sha512-KqAzJYotlZF57HNPAH6zyn9VxbRO38J/v4wr1QJ96QDnzzOFxGdFoBCToIaJ5vj/zm0lu+SJwdQgF0EJeo7jxA==",
+      "version": "6.0.4",
+      "resolved": "https://registry.npmjs.org/bpmn-moddle/-/bpmn-moddle-6.0.4.tgz",
+      "integrity": "sha512-8EkbAuIhWajEdLkWfkpV/91/AVGX/bexc+iA9WRuivdU6PKqhSXAOo052fSOmp3gBPZIv8hkz56f8GL0+eoWcw==",
       "requires": {
         "min-dash": "^3.0.0",
         "moddle": "^5.0.1",
-        "moddle-xml": "^8.0.3"
+        "moddle-xml": "^8.0.5"
       }
     },
     "brace-expansion": {
@@ -5836,13 +5836,13 @@
       }
     },
     "moddle-xml": {
-      "version": "8.0.3",
-      "resolved": "https://registry.npmjs.org/moddle-xml/-/moddle-xml-8.0.3.tgz",
-      "integrity": "sha512-sdN5rhNDnOWIC9j1piRgf0Trhz5oU5eh/pDqY5b1WumcLovl6ZBUIvZ1EBXc8bXQutbBOujAX2BM9+iUwTA+HA==",
+      "version": "8.0.5",
+      "resolved": "https://registry.npmjs.org/moddle-xml/-/moddle-xml-8.0.5.tgz",
+      "integrity": "sha512-c7foDi7pUTHIL00UBu5jEM/oIgasuoueVIrBa0Tg1EvWdDgdGprw2nyDPuEzVafthzKGd0lxFoO+U1ENcldrCQ==",
       "requires": {
         "min-dash": "^3.0.0",
         "moddle": "^5.0.1",
-        "saxen": "^8.1.1"
+        "saxen": "^8.1.2"
       }
     },
     "moment": {
@@ -8010,9 +8010,9 @@
       "dev": true
     },
     "saxen": {
-      "version": "8.1.1",
-      "resolved": "https://registry.npmjs.org/saxen/-/saxen-8.1.1.tgz",
-      "integrity": "sha512-V56ToYbmrCtAPHcuh7ZqCohs5vrMdRXFhxl7tI6KhVxWNB2HLduYgcrS9xeMe4YE5SsvuKy8nBYL3cg2M+nIPA=="
+      "version": "8.1.2",
+      "resolved": "https://registry.npmjs.org/saxen/-/saxen-8.1.2.tgz",
+      "integrity": "sha512-xUOiiFbc3Ow7p8KMxwsGICPx46ZQvy3+qfNVhrkwfz3Vvq45eGt98Ft5IQaA1R/7Tb5B5MKh9fUR9x3c3nDTxw=="
     },
     "schema-utils": {
       "version": "0.3.0",
diff --git a/package.json b/package.json
index 705dfabf..2a8f9ccf 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
   },
   "dependencies": {
     "bpmn-font": "^0.9.3",
-    "bpmn-moddle": "^6.0.3",
+    "bpmn-moddle": "^6.0.4",
     "css.escape": "^1.5.1",
     "diagram-js": "^6.5.0",
     "diagram-js-direct-editing": "^1.6.1",

From 46d303c4966cddbe9e90421caa752157f94d5668 Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Wed, 8 Apr 2020 10:43:42 +0200
Subject: [PATCH 19/27] chore(CHANGELOG): update

---
 CHANGELOG.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e81c1be..8573388b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,8 +8,8 @@ ___Note:__ Yet to be released changes appear here._
 
 ## 6.4.1
 
-* `FIX`: parse `>` in attribute names
-* `CHORE`: bump to `bpmn-moddle@6.0.3`
+* `FIX`: parse `>` in attribute names and body tag
+* `CHORE`: bump to `bpmn-moddle@6.0.4`
 
 ## 6.4.0
 

From f68f961f1606981463f319358aa6f92cd04dfbbf Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Wed, 8 Apr 2020 10:47:46 +0200
Subject: [PATCH 20/27] 6.4.1

---
 package-lock.json | 2 +-
 package.json      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 424fceec..07f0ee14 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "bpmn-js",
-  "version": "6.4.0",
+  "version": "6.4.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 2a8f9ccf..c7e01311 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "bpmn-js",
-  "version": "6.4.0",
+  "version": "6.4.1",
   "description": "A bpmn 2.0 toolkit and web modeler",
   "scripts": {
     "all": "run-s lint test distro test:distro",

From e03a4b2c59daa664a34ce3a5ce75525ad446930a Mon Sep 17 00:00:00 2001
From: Philipp Fromme 
Date: Mon, 2 Mar 2020 14:26:09 +0100
Subject: [PATCH 21/27] chore(auto-place): move common feature to diagram-js

https://github.com/bpmn-io/dmn-js/issues/470
---
 lib/features/auto-place/AutoPlace.js          |  58 ---
 .../auto-place/AutoPlaceSelectionBehavior.js  |  18 -
 lib/features/auto-place/AutoPlaceUtil.js      | 430 ------------------
 lib/features/auto-place/BpmnAutoPlace.js      |  18 +
 lib/features/auto-place/BpmnAutoPlaceUtil.js  | 134 ++++++
 lib/features/auto-place/index.js              |  11 +-
 .../behavior/AutoPlaceBehavior.js             |   6 +-
 ...pmn => BpmnAutoPlace.boundary-events.bpmn} |   0
 .../{AutoPlace.bpmn => BpmnAutoPlace.bpmn}    |   0
 ...mn => BpmnAutoPlace.multi-connection.bpmn} |   0
 ...{AutoPlaceSpec.js => BpmnAutoPlaceSpec.js} | 118 +----
 11 files changed, 169 insertions(+), 624 deletions(-)
 delete mode 100644 lib/features/auto-place/AutoPlace.js
 delete mode 100644 lib/features/auto-place/AutoPlaceSelectionBehavior.js
 delete mode 100644 lib/features/auto-place/AutoPlaceUtil.js
 create mode 100644 lib/features/auto-place/BpmnAutoPlace.js
 create mode 100644 lib/features/auto-place/BpmnAutoPlaceUtil.js
 rename test/spec/features/auto-place/{AutoPlace.boundary-events.bpmn => BpmnAutoPlace.boundary-events.bpmn} (100%)
 rename test/spec/features/auto-place/{AutoPlace.bpmn => BpmnAutoPlace.bpmn} (100%)
 rename test/spec/features/auto-place/{AutoPlace.multi-connection.bpmn => BpmnAutoPlace.multi-connection.bpmn} (100%)
 rename test/spec/features/auto-place/{AutoPlaceSpec.js => BpmnAutoPlaceSpec.js} (72%)

diff --git a/lib/features/auto-place/AutoPlace.js b/lib/features/auto-place/AutoPlace.js
deleted file mode 100644
index 9c7349e3..00000000
--- a/lib/features/auto-place/AutoPlace.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import { getNewShapePosition } from './AutoPlaceUtil';
-
-
-/**
- * A service that places elements connected to existing ones
- * to an appropriate position in an _automated_ fashion.
- *
- * @param {EventBus} eventBus
- * @param {Modeling} modeling
- */
-export default function AutoPlace(eventBus, modeling) {
-
-  function emit(event, payload) {
-    return eventBus.fire(event, payload);
-  }
-
-
-  /**
-   * Append shape to source at appropriate position.
-   *
-   * @param {djs.model.Shape} source
-   * @param {djs.model.Shape} shape
-   *
-   * @return {djs.model.Shape} appended shape
-   */
-  this.append = function(source, shape) {
-
-    emit('autoPlace.start', {
-      source: source,
-      shape: shape
-    });
-
-    // allow others to provide the position
-    var position = emit('autoPlace', {
-      source: source,
-      shape: shape
-    });
-
-    if (!position) {
-      position = getNewShapePosition(source, shape);
-    }
-
-    var newShape = modeling.appendShape(source, shape, position, source.parent);
-
-    emit('autoPlace.end', {
-      source: source,
-      shape: newShape
-    });
-
-    return newShape;
-  };
-
-}
-
-AutoPlace.$inject = [
-  'eventBus',
-  'modeling'
-];
\ No newline at end of file
diff --git a/lib/features/auto-place/AutoPlaceSelectionBehavior.js b/lib/features/auto-place/AutoPlaceSelectionBehavior.js
deleted file mode 100644
index 6024694c..00000000
--- a/lib/features/auto-place/AutoPlaceSelectionBehavior.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Select element after auto placement.
- *
- * @param {EventBus} eventBus
- * @param {Selection} selection
- */
-export default function AutoPlaceSelectionBehavior(eventBus, selection) {
-
-  eventBus.on('autoPlace.end', 500, function(e) {
-    selection.select(e.shape);
-  });
-
-}
-
-AutoPlaceSelectionBehavior.$inject = [
-  'eventBus',
-  'selection'
-];
\ No newline at end of file
diff --git a/lib/features/auto-place/AutoPlaceUtil.js b/lib/features/auto-place/AutoPlaceUtil.js
deleted file mode 100644
index bee66ef6..00000000
--- a/lib/features/auto-place/AutoPlaceUtil.js
+++ /dev/null
@@ -1,430 +0,0 @@
-import { is } from '../../util/ModelUtil';
-import { isAny } from '../modeling/util/ModelingUtil';
-
-import {
-  getMid,
-  asTRBL,
-  getOrientation
-} from 'diagram-js/lib/layout/LayoutUtil';
-
-import {
-  find,
-  reduce
-} from 'min-dash';
-
-var DEFAULT_HORIZONTAL_DISTANCE = 50;
-
-var MAX_HORIZONTAL_DISTANCE = 250;
-
-// padding to detect element placement
-var PLACEMENT_DETECTION_PAD = 10;
-
-/**
- * Find the new position for the target element to
- * connect to source.
- *
- * @param  {djs.model.Shape} source
- * @param  {djs.model.Shape} element
- *
- * @return {Point}
- */
-export function getNewShapePosition(source, element) {
-
-  if (is(element, 'bpmn:TextAnnotation')) {
-    return getTextAnnotationPosition(source, element);
-  }
-
-  if (isAny(element, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
-    return getDataElementPosition(source, element);
-  }
-
-  if (is(element, 'bpmn:FlowNode')) {
-    return getFlowNodePosition(source, element);
-  }
-
-  return getDefaultPosition(source, element);
-}
-
-/**
- * Always try to place element right of source;
- * compute actual distance from previous nodes in flow.
- */
-export function getFlowNodePosition(source, element) {
-
-  var sourceTrbl = asTRBL(source);
-  var sourceMid = getMid(source);
-
-  var horizontalDistance = getFlowNodeDistance(source, element);
-
-  var orientation = 'left',
-      rowSize = 80,
-      margin = 30;
-
-  if (is(source, 'bpmn:BoundaryEvent')) {
-    orientation = getOrientation(source, source.host, -25);
-
-    if (orientation.indexOf('top') !== -1) {
-      margin *= -1;
-    }
-  }
-
-  function getVerticalDistance(orient) {
-    if (orient.indexOf('top') != -1) {
-      return -1 * rowSize;
-    } else if (orient.indexOf('bottom') != -1) {
-      return rowSize;
-    } else {
-      return 0;
-    }
-  }
-
-  var position = {
-    x: sourceTrbl.right + horizontalDistance + element.width / 2,
-    y: sourceMid.y + getVerticalDistance(orientation)
-  };
-
-  var escapeDirection = {
-    y: {
-      margin: margin,
-      rowSize: rowSize
-    }
-  };
-
-  return deconflictPosition(source, element, position, escapeDirection);
-}
-
-
-/**
- * Compute best distance between source and target,
- * based on existing connections to and from source.
- *
- * @param {djs.model.Shape} source
- * @param {djs.model.Shape} element
- *
- * @return {number} distance
- */
-export function getFlowNodeDistance(source, element) {
-
-  var sourceTrbl = asTRBL(source);
-
-  // is connection a reference to consider?
-  function isReference(c) {
-    return is(c, 'bpmn:SequenceFlow');
-  }
-
-  function toTargetNode(weight) {
-
-    return function(shape) {
-      return {
-        shape: shape,
-        weight: weight,
-        distanceTo: function(shape) {
-          var shapeTrbl = asTRBL(shape);
-
-          return shapeTrbl.left - sourceTrbl.right;
-        }
-      };
-    };
-  }
-
-  function toSourceNode(weight) {
-    return function(shape) {
-      return {
-        shape: shape,
-        weight: weight,
-        distanceTo: function(shape) {
-          var shapeTrbl = asTRBL(shape);
-
-          return sourceTrbl.left - shapeTrbl.right;
-        }
-      };
-    };
-  }
-
-  // we create a list of nodes to take into consideration
-  // for calculating the optimal flow node distance
-  //
-  //   * weight existing target nodes higher than source nodes
-  //   * only take into account individual nodes once
-  //
-  var nodes = reduce([].concat(
-    getTargets(source, isReference).map(toTargetNode(5)),
-    getSources(source, isReference).map(toSourceNode(1))
-  ), function(nodes, node) {
-
-    // filter out shapes connected twice via source or target
-    nodes[node.shape.id + '__weight_' + node.weight] = node;
-
-    return nodes;
-  }, {});
-
-  // compute distances between source and incoming nodes;
-  // group at the same time by distance and expose the
-  // favourite distance as { fav: { count, value } }.
-  var distancesGrouped = reduce(nodes, function(result, node) {
-
-    var shape = node.shape,
-        weight = node.weight,
-        distanceTo = node.distanceTo;
-
-    var fav = result.fav,
-        currentDistance,
-        currentDistanceCount,
-        currentDistanceEntry;
-
-    currentDistance = distanceTo(shape);
-
-    // ignore too far away peers
-    // or non-left to right modeled nodes
-    if (currentDistance < 0 || currentDistance > MAX_HORIZONTAL_DISTANCE) {
-      return result;
-    }
-
-    currentDistanceEntry = result[String(currentDistance)] =
-      result[String(currentDistance)] || {
-        value: currentDistance,
-        count: 0
-      };
-
-    // inc diff count
-    currentDistanceCount = currentDistanceEntry.count += 1 * weight;
-
-    if (!fav || fav.count < currentDistanceCount) {
-      result.fav = currentDistanceEntry;
-    }
-
-    return result;
-  }, { });
-
-
-  if (distancesGrouped.fav) {
-    return distancesGrouped.fav.value;
-  } else {
-    return DEFAULT_HORIZONTAL_DISTANCE;
-  }
-}
-
-
-/**
- * Always try to place text annotations top right of source.
- */
-export function getTextAnnotationPosition(source, element) {
-
-  var sourceTrbl = asTRBL(source);
-
-  var position = {
-    x: sourceTrbl.right + element.width / 2,
-    y: sourceTrbl.top - 50 - element.height / 2
-  };
-
-  var escapeDirection = {
-    y: {
-      margin: -30,
-      rowSize: 20
-    }
-  };
-
-  return deconflictPosition(source, element, position, escapeDirection);
-}
-
-
-/**
- * Always put element bottom right of source.
- */
-export function getDataElementPosition(source, element) {
-
-  var sourceTrbl = asTRBL(source);
-
-  var position = {
-    x: sourceTrbl.right - 10 + element.width / 2,
-    y: sourceTrbl.bottom + 40 + element.width / 2
-  };
-
-  var escapeDirection = {
-    x: {
-      margin: 30,
-      rowSize: 30
-    }
-  };
-
-  return deconflictPosition(source, element, position, escapeDirection);
-}
-
-
-/**
- * Always put element right of source per default.
- */
-export function getDefaultPosition(source, element) {
-
-  var sourceTrbl = asTRBL(source);
-
-  var sourceMid = getMid(source);
-
-  // simply put element right next to source
-  return {
-    x: sourceTrbl.right + DEFAULT_HORIZONTAL_DISTANCE + element.width / 2,
-    y: sourceMid.y
-  };
-}
-
-
-/**
- * Returns all connected elements around the given source.
- *
- * This includes:
- *
- *   - connected elements
- *   - host connected elements
- *   - attachers connected elements
- *
- * @param  {djs.model.Shape} source
- * @param  {djs.model.Shape} element
- *
- * @return {Array}
- */
-function getAutoPlaceClosure(source, element) {
-
-  var allConnected = getConnected(source);
-
-  if (source.host) {
-    allConnected = allConnected.concat(getConnected(source.host));
-  }
-
-  if (source.attachers) {
-    allConnected = allConnected.concat(source.attachers.reduce(function(shapes, attacher) {
-      return shapes.concat(getConnected(attacher));
-    }, []));
-  }
-
-  return allConnected;
-}
-
-/**
- * Return target at given position, if defined.
- *
- * This takes connected elements from host and attachers
- * into account, too.
- */
-export function getConnectedAtPosition(source, position, element) {
-
-  var bounds = {
-    x: position.x - (element.width / 2),
-    y: position.y - (element.height / 2),
-    width: element.width,
-    height: element.height
-  };
-
-  var closure = getAutoPlaceClosure(source, element);
-
-  return find(closure, function(target) {
-
-    if (target === element) {
-      return false;
-    }
-
-    var orientation = getOrientation(target, bounds, PLACEMENT_DETECTION_PAD);
-
-    return orientation === 'intersect';
-  });
-}
-
-
-/**
- * Returns a new, position for the given element
- * based on the given element that is not occupied
- * by some element connected to source.
- *
- * Take into account the escapeDirection (where to move
- * on positioning clashes) in the computation.
- *
- * @param {djs.model.Shape} source
- * @param {djs.model.Shape} element
- * @param {Point} position
- * @param {Object} escapeDelta
- *
- * @return {Point}
- */
-export function deconflictPosition(source, element, position, escapeDelta) {
-
-  function nextPosition(existingElement) {
-
-    var newPosition = {
-      x: position.x,
-      y: position.y
-    };
-
-    [ 'x', 'y' ].forEach(function(axis) {
-
-      var axisDelta = escapeDelta[axis];
-
-      if (!axisDelta) {
-        return;
-      }
-
-      var dimension = axis === 'x' ? 'width' : 'height';
-
-      var margin = axisDelta.margin,
-          rowSize = axisDelta.rowSize;
-
-      if (margin < 0) {
-        newPosition[axis] = Math.min(
-          existingElement[axis] + margin - element[dimension] / 2,
-          position[axis] - rowSize + margin
-        );
-      } else {
-        newPosition[axis] = Math.max(
-          existingTarget[axis] + existingTarget[dimension] + margin + element[dimension] / 2,
-          position[axis] + rowSize + margin
-        );
-      }
-    });
-
-    return newPosition;
-  }
-
-  var existingTarget;
-
-  // deconflict position until free slot is found
-  while ((existingTarget = getConnectedAtPosition(source, position, element))) {
-    position = nextPosition(existingTarget);
-  }
-
-  return position;
-}
-
-
-
-// helpers //////////////////////
-
-function noneFilter() {
-  return true;
-}
-
-function getConnected(element, connectionFilter) {
-  return [].concat(
-    getTargets(element, connectionFilter),
-    getSources(element, connectionFilter)
-  );
-}
-
-function getSources(shape, connectionFilter) {
-
-  if (!connectionFilter) {
-    connectionFilter = noneFilter;
-  }
-
-  return shape.incoming.filter(connectionFilter).map(function(c) {
-    return c.source;
-  });
-}
-
-function getTargets(shape, connectionFilter) {
-
-  if (!connectionFilter) {
-    connectionFilter = noneFilter;
-  }
-
-  return shape.outgoing.filter(connectionFilter).map(function(c) {
-    return c.target;
-  });
-}
\ No newline at end of file
diff --git a/lib/features/auto-place/BpmnAutoPlace.js b/lib/features/auto-place/BpmnAutoPlace.js
new file mode 100644
index 00000000..cd2e1171
--- /dev/null
+++ b/lib/features/auto-place/BpmnAutoPlace.js
@@ -0,0 +1,18 @@
+import { getNewShapePosition } from './BpmnAutoPlaceUtil';
+
+
+/**
+ * BPMN auto-place behavior.
+ *
+ * @param {EventBus} eventBus
+ */
+export default function AutoPlace(eventBus) {
+  eventBus.on('autoPlace', function(context) {
+    var shape = context.shape,
+        source = context.source;
+
+    return getNewShapePosition(source, shape);
+  });
+}
+
+AutoPlace.$inject = [ 'eventBus' ];
\ No newline at end of file
diff --git a/lib/features/auto-place/BpmnAutoPlaceUtil.js b/lib/features/auto-place/BpmnAutoPlaceUtil.js
new file mode 100644
index 00000000..1e6af72d
--- /dev/null
+++ b/lib/features/auto-place/BpmnAutoPlaceUtil.js
@@ -0,0 +1,134 @@
+import { is } from '../../util/ModelUtil';
+import { isAny } from '../modeling/util/ModelingUtil';
+
+import {
+  getMid,
+  asTRBL,
+  getOrientation
+} from 'diagram-js/lib/layout/LayoutUtil';
+
+import {
+  deconflictPosition,
+  getConnectedDistance
+} from 'diagram-js/lib/features/auto-place/AutoPlaceUtil';
+
+
+/**
+ * Find the new position for the target element to
+ * connect to source.
+ *
+ * @param  {djs.model.Shape} source
+ * @param  {djs.model.Shape} element
+ *
+ * @return {Point}
+ */
+export function getNewShapePosition(source, element) {
+
+  if (is(element, 'bpmn:TextAnnotation')) {
+    return getTextAnnotationPosition(source, element);
+  }
+
+  if (isAny(element, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
+    return getDataElementPosition(source, element);
+  }
+
+  if (is(element, 'bpmn:FlowNode')) {
+    return getFlowNodePosition(source, element);
+  }
+}
+
+/**
+ * Always try to place element right of source;
+ * compute actual distance from previous nodes in flow.
+ */
+export function getFlowNodePosition(source, element) {
+
+  var sourceTrbl = asTRBL(source);
+  var sourceMid = getMid(source);
+
+  var horizontalDistance = getConnectedDistance(source, 'x', function(connection) {
+    return is(connection, 'bpmn:SequenceFlow');
+  });
+
+  var orientation = 'left',
+      rowSize = 80,
+      margin = 30;
+
+  if (is(source, 'bpmn:BoundaryEvent')) {
+    orientation = getOrientation(source, source.host, -25);
+
+    if (orientation.indexOf('top') !== -1) {
+      margin *= -1;
+    }
+  }
+
+  function getVerticalDistance(orient) {
+    if (orient.indexOf('top') != -1) {
+      return -1 * rowSize;
+    } else if (orient.indexOf('bottom') != -1) {
+      return rowSize;
+    } else {
+      return 0;
+    }
+  }
+
+  var position = {
+    x: sourceTrbl.right + horizontalDistance + element.width / 2,
+    y: sourceMid.y + getVerticalDistance(orientation)
+  };
+
+  var escapeDirection = {
+    y: {
+      margin: margin,
+      rowSize: rowSize
+    }
+  };
+
+  return deconflictPosition(source, element, position, escapeDirection);
+}
+
+
+/**
+ * Always try to place text annotations top right of source.
+ */
+export function getTextAnnotationPosition(source, element) {
+
+  var sourceTrbl = asTRBL(source);
+
+  var position = {
+    x: sourceTrbl.right + element.width / 2,
+    y: sourceTrbl.top - 50 - element.height / 2
+  };
+
+  var escapeDirection = {
+    y: {
+      margin: -30,
+      rowSize: 20
+    }
+  };
+
+  return deconflictPosition(source, element, position, escapeDirection);
+}
+
+
+/**
+ * Always put element bottom right of source.
+ */
+export function getDataElementPosition(source, element) {
+
+  var sourceTrbl = asTRBL(source);
+
+  var position = {
+    x: sourceTrbl.right - 10 + element.width / 2,
+    y: sourceTrbl.bottom + 40 + element.width / 2
+  };
+
+  var escapeDirection = {
+    x: {
+      margin: 30,
+      rowSize: 30
+    }
+  };
+
+  return deconflictPosition(source, element, position, escapeDirection);
+}
\ No newline at end of file
diff --git a/lib/features/auto-place/index.js b/lib/features/auto-place/index.js
index cf9a7a0b..47516500 100644
--- a/lib/features/auto-place/index.js
+++ b/lib/features/auto-place/index.js
@@ -1,8 +1,9 @@
-import AutoPlace from './AutoPlace';
-import AutoPlaceSelectionBehavior from './AutoPlaceSelectionBehavior';
+import AutoPlaceModule from 'diagram-js/lib/features/auto-place';
+
+import BpmnAutoPlace from './BpmnAutoPlace';
 
 export default {
-  __init__: [ 'autoPlaceSelectionBehavior' ],
-  autoPlace: [ 'type', AutoPlace ],
-  autoPlaceSelectionBehavior: [ 'type', AutoPlaceSelectionBehavior ]
+  __depends__: [ AutoPlaceModule ],
+  __init__: [ 'bpmnAutoPlace' ],
+  bpmnAutoPlace: [ 'type', BpmnAutoPlace ]
 };
\ No newline at end of file
diff --git a/lib/features/grid-snapping/behavior/AutoPlaceBehavior.js b/lib/features/grid-snapping/behavior/AutoPlaceBehavior.js
index 820b1a01..63c9e5d8 100644
--- a/lib/features/grid-snapping/behavior/AutoPlaceBehavior.js
+++ b/lib/features/grid-snapping/behavior/AutoPlaceBehavior.js
@@ -1,11 +1,13 @@
-import { getNewShapePosition } from '../../auto-place/AutoPlaceUtil';
+import { getNewShapePosition } from '../../auto-place/BpmnAutoPlaceUtil';
 
 import { getMid } from 'diagram-js/lib/layout/LayoutUtil';
 import { is } from '../../../util/ModelUtil';
 
+var HIGH_PRIORITY = 2000;
+
 
 export default function AutoPlaceBehavior(eventBus, gridSnapping) {
-  eventBus.on('autoPlace', function(context) {
+  eventBus.on('autoPlace', HIGH_PRIORITY, function(context) {
     var source = context.source,
         sourceMid = getMid(source),
         shape = context.shape;
diff --git a/test/spec/features/auto-place/AutoPlace.boundary-events.bpmn b/test/spec/features/auto-place/BpmnAutoPlace.boundary-events.bpmn
similarity index 100%
rename from test/spec/features/auto-place/AutoPlace.boundary-events.bpmn
rename to test/spec/features/auto-place/BpmnAutoPlace.boundary-events.bpmn
diff --git a/test/spec/features/auto-place/AutoPlace.bpmn b/test/spec/features/auto-place/BpmnAutoPlace.bpmn
similarity index 100%
rename from test/spec/features/auto-place/AutoPlace.bpmn
rename to test/spec/features/auto-place/BpmnAutoPlace.bpmn
diff --git a/test/spec/features/auto-place/AutoPlace.multi-connection.bpmn b/test/spec/features/auto-place/BpmnAutoPlace.multi-connection.bpmn
similarity index 100%
rename from test/spec/features/auto-place/AutoPlace.multi-connection.bpmn
rename to test/spec/features/auto-place/BpmnAutoPlace.multi-connection.bpmn
diff --git a/test/spec/features/auto-place/AutoPlaceSpec.js b/test/spec/features/auto-place/BpmnAutoPlaceSpec.js
similarity index 72%
rename from test/spec/features/auto-place/AutoPlaceSpec.js
rename to test/spec/features/auto-place/BpmnAutoPlaceSpec.js
index 993b45db..a672802e 100644
--- a/test/spec/features/auto-place/AutoPlaceSpec.js
+++ b/test/spec/features/auto-place/BpmnAutoPlaceSpec.js
@@ -11,14 +11,12 @@ import selectionModule from 'diagram-js/lib/features/selection';
 
 import { getBusinessObject } from '../../../../lib/util/ModelUtil';
 
-import { getMid } from 'diagram-js/lib/layout/LayoutUtil';
-
 
 describe('features/auto-place', function() {
 
   describe('element placement', function() {
 
-    var diagramXML = require('./AutoPlace.bpmn');
+    var diagramXML = require('./BpmnAutoPlace.bpmn');
 
     before(bootstrapModeler(diagramXML, {
       modules: [
@@ -116,7 +114,7 @@ describe('features/auto-place', function() {
 
   describe('integration', function() {
 
-    var diagramXML = require('./AutoPlace.bpmn');
+    var diagramXML = require('./BpmnAutoPlace.bpmn');
 
     before(bootstrapModeler(diagramXML, {
       modules: [
@@ -174,7 +172,7 @@ describe('features/auto-place', function() {
 
   describe('multi connection handling', function() {
 
-    var diagramXML = require('./AutoPlace.multi-connection.bpmn');
+    var diagramXML = require('./BpmnAutoPlace.multi-connection.bpmn');
 
     before(bootstrapModeler(diagramXML, {
       modules: [
@@ -209,7 +207,7 @@ describe('features/auto-place', function() {
 
   describe('boundary event connection handling', function() {
 
-    var diagramXML = require('./AutoPlace.boundary-events.bpmn');
+    var diagramXML = require('./BpmnAutoPlace.boundary-events.bpmn');
 
     before(bootstrapModeler(diagramXML, {
       modules: [
@@ -241,12 +239,14 @@ describe('features/auto-place', function() {
       expectedBounds: { x: 242, y: -27, width: 100, height: 80 }
     }));
 
+
     it('should place top right of BOUNDARY_TOP_RIGHT without infinite loop', autoPlace({
       element: 'bpmn:Task',
       behind: 'BOUNDARY_TOP_RIGHT',
       expectedBounds: { x: 473, y: -27, width: 100, height: 80 }
     }));
 
+
     it('should place top right of BOUNDARY_SUBPROCESS_TOP', autoPlace({
       element: 'bpmn:Task',
       behind: 'BOUNDARY_SUBPROCESS_TOP',
@@ -255,114 +255,10 @@ describe('features/auto-place', function() {
 
   });
 
-
-  describe('eventbus integration', function() {
-
-    var diagramXML = require('./AutoPlace.bpmn');
-
-    beforeEach(bootstrapModeler(diagramXML, {
-      modules: [
-        autoPlaceModule,
-        coreModule,
-        labelEditingModule,
-        modelingModule,
-        selectionModule
-      ]
-    }));
-
-
-    it('', inject(
-      function(autoPlace, elementFactory, elementRegistry, eventBus) {
-
-        // given
-        var element = elementFactory.createShape({ type: 'bpmn:Task' });
-
-        var source = elementRegistry.get('TASK_2');
-
-        var listener = sinon.spy(function(event) {
-
-          // then
-          expect(event.shape).to.equal(element);
-          expect(event.source).to.equal(source);
-        });
-
-        eventBus.on('autoPlace.start', listener);
-
-        // when
-        autoPlace.append(source, element);
-
-        expect(listener).to.have.been.called;
-      }
-    ));
-
-
-    it('', inject(
-      function(autoPlace, elementFactory, elementRegistry, eventBus) {
-
-        // given
-        var element = elementFactory.createShape({ type: 'bpmn:Task' });
-
-        var source = elementRegistry.get('TASK_2');
-
-        var listener = sinon.spy(function(event) {
-
-          // then
-          expect(event.shape).to.equal(element);
-          expect(event.source).to.equal(source);
-
-          return {
-            x: 0,
-            y: 0
-          };
-        });
-
-        eventBus.on('autoPlace', listener);
-
-        // when
-        autoPlace.append(source, element);
-
-        expect(listener).to.have.been.called;
-
-        expect(getMid(element)).to.eql({
-          x: 0,
-          y: 0
-        });
-      }
-    ));
-
-
-    it('', inject(
-      function(autoPlace, elementFactory, elementRegistry, eventBus) {
-
-        // given
-        var element = elementFactory.createShape({ type: 'bpmn:Task' });
-
-        var source = elementRegistry.get('TASK_2');
-
-        var listener = sinon.spy(function(event) {
-
-          // then
-          expect(event.shape).to.equal(element);
-          expect(event.source).to.equal(source);
-        });
-
-        eventBus.on('autoPlace.end', listener);
-
-        // when
-        autoPlace.append(source, element);
-
-        expect(listener).to.have.been.called;
-      }
-    ));
-
-  });
-
 });
 
 
-
-
-// helpers //////////////////////
+// helpers //////////
 
 function autoPlace(cfg) {
 

From 8d583dd91ffed6e821adb2323d074db8302373c5 Mon Sep 17 00:00:00 2001
From: Philipp Fromme 
Date: Mon, 9 Mar 2020 10:41:35 +0100
Subject: [PATCH 22/27] chore(auto-place): adjust to new auto place API

---
 lib/features/auto-place/BpmnAutoPlaceUtil.js | 56 +++++++++++---------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/lib/features/auto-place/BpmnAutoPlaceUtil.js b/lib/features/auto-place/BpmnAutoPlaceUtil.js
index 1e6af72d..bb7343ec 100644
--- a/lib/features/auto-place/BpmnAutoPlaceUtil.js
+++ b/lib/features/auto-place/BpmnAutoPlaceUtil.js
@@ -8,7 +8,8 @@ import {
 } from 'diagram-js/lib/layout/LayoutUtil';
 
 import {
-  deconflictPosition,
+  findFreePosition,
+  generateGetNextPosition,
   getConnectedDistance
 } from 'diagram-js/lib/features/auto-place/AutoPlaceUtil';
 
@@ -46,13 +47,15 @@ export function getFlowNodePosition(source, element) {
   var sourceTrbl = asTRBL(source);
   var sourceMid = getMid(source);
 
-  var horizontalDistance = getConnectedDistance(source, 'x', function(connection) {
-    return is(connection, 'bpmn:SequenceFlow');
+  var horizontalDistance = getConnectedDistance(source, {
+    filter: function(connection) {
+      return is(connection, 'bpmn:SequenceFlow');
+    }
   });
 
-  var orientation = 'left',
-      rowSize = 80,
-      margin = 30;
+  var margin = 30,
+      minDistance = 80,
+      orientation = 'left';
 
   if (is(source, 'bpmn:BoundaryEvent')) {
     orientation = getOrientation(source, source.host, -25);
@@ -62,29 +65,30 @@ export function getFlowNodePosition(source, element) {
     }
   }
 
-  function getVerticalDistance(orient) {
-    if (orient.indexOf('top') != -1) {
-      return -1 * rowSize;
-    } else if (orient.indexOf('bottom') != -1) {
-      return rowSize;
-    } else {
-      return 0;
-    }
-  }
-
   var position = {
     x: sourceTrbl.right + horizontalDistance + element.width / 2,
-    y: sourceMid.y + getVerticalDistance(orientation)
+    y: sourceMid.y + getVerticalDistance(orientation, minDistance)
   };
 
-  var escapeDirection = {
+  var nextPositionDirection = {
     y: {
       margin: margin,
-      rowSize: rowSize
+      minDistance: minDistance
     }
   };
 
-  return deconflictPosition(source, element, position, escapeDirection);
+  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
+}
+
+
+function getVerticalDistance(orientation, minDistance) {
+  if (orientation.indexOf('top') != -1) {
+    return -1 * minDistance;
+  } else if (orientation.indexOf('bottom') != -1) {
+    return minDistance;
+  } else {
+    return 0;
+  }
 }
 
 
@@ -100,14 +104,14 @@ export function getTextAnnotationPosition(source, element) {
     y: sourceTrbl.top - 50 - element.height / 2
   };
 
-  var escapeDirection = {
+  var nextPositionDirection = {
     y: {
       margin: -30,
-      rowSize: 20
+      minDistance: 20
     }
   };
 
-  return deconflictPosition(source, element, position, escapeDirection);
+  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
 }
 
 
@@ -123,12 +127,12 @@ export function getDataElementPosition(source, element) {
     y: sourceTrbl.bottom + 40 + element.width / 2
   };
 
-  var escapeDirection = {
+  var nextPositionDirection = {
     x: {
       margin: 30,
-      rowSize: 30
+      minDistance: 30
     }
   };
 
-  return deconflictPosition(source, element, position, escapeDirection);
+  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
 }
\ No newline at end of file

From ea2b1fa5e92845af6317df6a71533954656c1976 Mon Sep 17 00:00:00 2001
From: Maciej Barelkowski 
Date: Wed, 22 Apr 2020 20:33:10 +0200
Subject: [PATCH 23/27] chore(project): update diagram-js to v6.6.0

---
 package-lock.json | 6 +++---
 package.json      | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index d685256a..642c421c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2026,9 +2026,9 @@
       "dev": true
     },
     "diagram-js": {
-      "version": "6.5.0",
-      "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.5.0.tgz",
-      "integrity": "sha512-fayigJnTBrrQpYm4mmoKjo3v3ABkK/gIW1QFPC7CCZrXd/Jx9iC3JdShee1ucT1PSE2I86jRKnT9qdzeQk/ltQ==",
+      "version": "6.6.0",
+      "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.6.0.tgz",
+      "integrity": "sha512-clyMZRj/EFtShpWz1PxJBwHPM7tqrwFRhslXBQQbH1Vq0kEXd58McqauYtXOr1AXOvjSb5gCJiNa/FHreLjebg==",
       "requires": {
         "css.escape": "^1.5.1",
         "didi": "^4.0.0",
diff --git a/package.json b/package.json
index 067ebb58..b3c3eea2 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,7 @@
     "bpmn-font": "^0.9.3",
     "bpmn-moddle": "^6.0.5",
     "css.escape": "^1.5.1",
-    "diagram-js": "^6.5.0",
+    "diagram-js": "^6.6.0",
     "diagram-js-direct-editing": "^1.6.1",
     "ids": "^1.0.0",
     "inherits": "^2.0.1",

From 63045bdfa87b9f1989a2a7a509facbeb4616acda Mon Sep 17 00:00:00 2001
From: Nico Rehwaldt 
Date: Thu, 23 Apr 2020 11:07:58 +0200
Subject: [PATCH 24/27] chore(deps): make bpmn-font a development dependency

There is no need to download it in production as we already bundle it
with
the bpmn-js distribution.
---
 package-lock.json | 3 ++-
 package.json      | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 642c421c..d738c877 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1103,7 +1103,8 @@
     "bpmn-font": {
       "version": "0.9.3",
       "resolved": "https://registry.npmjs.org/bpmn-font/-/bpmn-font-0.9.3.tgz",
-      "integrity": "sha512-kzRGXGLzTROLRNCSskkOyj/+SbtTAn2unKfgB9tNt7RWJFybg/Wbe9YjK2ALotI3b64wwlCTkAalXiTiskP6dg=="
+      "integrity": "sha512-kzRGXGLzTROLRNCSskkOyj/+SbtTAn2unKfgB9tNt7RWJFybg/Wbe9YjK2ALotI3b64wwlCTkAalXiTiskP6dg==",
+      "dev": true
     },
     "bpmn-moddle": {
       "version": "6.0.5",
diff --git a/package.json b/package.json
index b3c3eea2..7ba31a87 100644
--- a/package.json
+++ b/package.json
@@ -39,6 +39,7 @@
     "*.css"
   ],
   "devDependencies": {
+    "bpmn-font": "^0.9.3",
     "camunda-bpmn-moddle": "^4.0.1",
     "chai": "^4.1.2",
     "chai-match": "^1.1.1",
@@ -79,7 +80,6 @@
     "webpack": "^4.35.3"
   },
   "dependencies": {
-    "bpmn-font": "^0.9.3",
     "bpmn-moddle": "^6.0.5",
     "css.escape": "^1.5.1",
     "diagram-js": "^6.6.0",

From b52faad768046c64657f1ca94ba97c25f3d464c8 Mon Sep 17 00:00:00 2001
From: Philipp Fromme 
Date: Mon, 27 Apr 2020 15:15:44 +0200
Subject: [PATCH 25/27] chore(project): bump to diagram-js@6.6.1

---
 package-lock.json | 6 +++---
 package.json      | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index d738c877..f1e0ee3d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2027,9 +2027,9 @@
       "dev": true
     },
     "diagram-js": {
-      "version": "6.6.0",
-      "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.6.0.tgz",
-      "integrity": "sha512-clyMZRj/EFtShpWz1PxJBwHPM7tqrwFRhslXBQQbH1Vq0kEXd58McqauYtXOr1AXOvjSb5gCJiNa/FHreLjebg==",
+      "version": "6.6.1",
+      "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-6.6.1.tgz",
+      "integrity": "sha512-3SlXwT2ieXCZkQn8dVZWfNry9+6d4R+0Q57Oz9t/SfIyNIrRPg0c9IlsaTHpGUhPE3fossXPDjmvqjJD0lmBLw==",
       "requires": {
         "css.escape": "^1.5.1",
         "didi": "^4.0.0",
diff --git a/package.json b/package.json
index 7ba31a87..13d77107 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,7 @@
   "dependencies": {
     "bpmn-moddle": "^6.0.5",
     "css.escape": "^1.5.1",
-    "diagram-js": "^6.6.0",
+    "diagram-js": "^6.6.1",
     "diagram-js-direct-editing": "^1.6.1",
     "ids": "^1.0.0",
     "inherits": "^2.0.1",

From 0816e4b1997d4e841d388dafbb5b303b3c427fbf Mon Sep 17 00:00:00 2001
From: Philipp Fromme 
Date: Mon, 27 Apr 2020 15:15:57 +0200
Subject: [PATCH 26/27] chore(CHANGELOG): update

---
 CHANGELOG.md | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39a0b43a..94251d16 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,13 @@ All notable changes to [bpmn-js](https://github.com/bpmn-io/bpmn-js) are documen
 
 ___Note:__ Yet to be released changes appear here._
 
+## 6.5.0
+
+* `FEAT`: prefer straight layout for sub-process connections ([#1309](https://github.com/bpmn-io/bpmn-js/pull/1309))
+* `FEAT`: move common auto-place feature to diagram-js, add BPMN-specific auto-place feature ([#1284](https://github.com/bpmn-io/bpmn-js/pull/1284))
+* `CHORE`: make bpmn-font a development dependency ([`63045bdf`](https://github.com/bpmn-io/bpmn-js/commit/63045bdfa87b9f1989a2a7a509facbeb4616acda))
+* `CHORE`: bump to `diagram-js@6.6.1`
+
 ## 6.4.2
 
 * `CHORE`: bump to `bpmn-moddle@6.0.5`

From 40991a0b7603a47f532311929e0c738691b183fc Mon Sep 17 00:00:00 2001
From: Philipp Fromme 
Date: Tue, 28 Apr 2020 13:49:50 +0200
Subject: [PATCH 27/27] 6.5.0

---
 package-lock.json | 2 +-
 package.json      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index f1e0ee3d..be5d1bfc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "bpmn-js",
-  "version": "6.4.2",
+  "version": "6.5.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index 13d77107..401d34f8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "bpmn-js",
-  "version": "6.4.2",
+  "version": "6.5.0",
   "description": "A bpmn 2.0 toolkit and web modeler",
   "scripts": {
     "all": "run-s lint test distro test:distro",