fix(bpmn-rules): allow to drop Boundary Events only on containers

Closes https://github.com/bpmn-io/bpmn-js/issues/1095
This commit is contained in:
Maciej Barelkowski 2019-06-24 13:16:11 +02:00 committed by merge-me[bot]
parent 6aa0e5c95b
commit 890e466161
2 changed files with 13 additions and 4 deletions

View File

@ -479,10 +479,9 @@ function canDrop(element, target, position) {
return is(target, 'bpmn:Participant') || is(target, 'bpmn:Lane'); return is(target, 'bpmn:Participant') || is(target, 'bpmn:Lane');
} }
if (is(element, 'bpmn:BoundaryEvent')) { // disallow dropping boundary events which cannot replace with intermediate event
return getBusinessObject(element).cancelActivity && ( if (is(element, 'bpmn:BoundaryEvent') && !isDroppableBoundaryEvent(element)) {
hasNoEventDefinition(element) || hasCommonBoundaryIntermediateEventDefinition(element) return false;
);
} }
// drop flow elements onto flow element containers // drop flow elements onto flow element containers
@ -517,6 +516,12 @@ function canDrop(element, target, position) {
return false; return false;
} }
function isDroppableBoundaryEvent(event) {
return getBusinessObject(event).cancelActivity && (
hasNoEventDefinition(event) || hasCommonBoundaryIntermediateEventDefinition(event)
);
}
function canPaste(tree, target) { function canPaste(tree, target) {
var topLevel = tree[0], var topLevel = tree[0],
participants; participants;

View File

@ -470,6 +470,10 @@ describe('features/modeling/rules - BpmnRules', function() {
}); });
})); }));
it('drop BoundaryEvent -> Task', function() {
expectCanDrop('BoundaryEvent_on_SubProcess', 'Task_in_OtherProcess', false);
});
}); });