bpmn-js/lib/features/modeling/behavior/CreateBehavior.js
Philipp Fromme 194b963959 chore(copy-paste): rework and base upon diagram-js@5
* use <copyPaste.canCopyProperty> event to copy category value when copying group
* add camunda-bpmn-moddle for integration tests

BREAKING CHANGES

* CopyPaste: remove <property.clone>, add <moddleCopy.canCopyProperties>, <moddleCopy.canCopyProperty>, <moddleCopy.canSetCopiedProperty>
* BpmnRules: removed <elements.paste> rule in favor of <elements.create> rule
* BpmnRules: removed <element.paste> rule
* ElementFactory: use <attrs.di> property instead of <attrs.colors> for fill and stroke when creating element through ElementFactory#createBpmnElement
2019-08-07 16:03:55 +00:00

27 lines
633 B
JavaScript

import inherits from 'inherits';
import { is } from '../../../util/ModelUtil';
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
import { getParent } from '../util/ModelingUtil';
export default function CreateBehavior(injector) {
injector.invoke(CommandInterceptor, this);
this.preExecute('shape.create', 1500, function(event) {
var context = event.context,
parent = context.parent;
if (is(parent, 'bpmn:Lane')) {
context.parent = getParent(parent, 'bpmn:Participant');
}
});
}
CreateBehavior.$inject = [ 'injector' ];
inherits(CreateBehavior, CommandInterceptor);