diff --git a/lib/features/modeling/rules/BpmnRules.js b/lib/features/modeling/rules/BpmnRules.js index 829803a9..e4a4cd98 100644 --- a/lib/features/modeling/rules/BpmnRules.js +++ b/lib/features/modeling/rules/BpmnRules.js @@ -378,10 +378,7 @@ function canAttach(elements, target, source, position) { function canMove(elements, target) { // only move if they have the same parent - var sameParent = size(groupBy(elements, function(s) { return s.parent && s.parent.id; })) === 1; - - // Remove attachers that already have their host in the lis - if (!sameParent) { + if (!haveSameParent(elements)) { return false; } @@ -501,3 +498,13 @@ function canConnectBoundaryEvent(source, target) { return false; } + +/** + * Returns true if all elements have the same parent + * + * @param {Array} elements + * @return {Boolean} + */ +function haveSameParent(elements) { + return size(groupBy(elements, function(e) { return e.parent && e.parent.id; })) === 1; +}