feat(rules): add resizing of groups

Closes #956
This commit is contained in:
Niklas Kiefer 2019-05-02 10:39:07 +02:00
parent 89886d7c12
commit bf2dfe4338
3 changed files with 68 additions and 1 deletions

View File

@ -254,6 +254,10 @@ function isTextAnnotation(element) {
return is(element, 'bpmn:TextAnnotation');
}
function isGroup(element) {
return is(element, 'bpmn:Group');
}
function isCompensationBoundary(element) {
return is(element, 'bpmn:BoundaryEvent') &&
hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
@ -455,7 +459,7 @@ function canDrop(element, target, position) {
}
// allow to create new participants on
// on existing collaboration and process diagrams
// existing collaboration and process diagrams
if (is(element, 'bpmn:Participant')) {
return is(target, 'bpmn:Process') || is(target, 'bpmn:Collaboration');
}
@ -777,6 +781,10 @@ function canResize(shape, newBounds) {
return true;
}
if (isGroup(shape)) {
return true;
}
return false;
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:signavio="http://www.signavio.com" xmlns:tns="http://www.signavio.com/bpmn20" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:yaoqiang="http://bpmn.sourceforge.net" id="sid-0fcc2144-457b-4505-9e44-ff673663e3bc" name="" targetNamespace="http://www.signavio.com/bpmn20" exporter="Camunda Modeler" exporterVersion="3.0.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://bpmn.sourceforge.net/schemas/BPMN20.xsd">
<category id="Category_1">
<categoryValue id="CategoryValue_1" value="group" />
</category>
<process id="Process_1" isExecutable="false">
<startEvent id="StartEvent_1" />
<task id="Task_1" />
<subProcess id="SubProcess_1" />
<group id="Group_1" categoryValueRef="CategoryValue_1" />
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane bpmnElement="Process_1">
<bpmndi:BPMNShape id="BPMNShape_1" bpmnElement="Group_1">
<omgdc:Bounds x="189" y="62" width="400" height="254" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="276" y="98" width="58" height="18.96" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_2" bpmnElement="StartEvent_1">
<omgdc:Bounds x="296" y="379" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_3" bpmnElement="Task_1">
<omgdc:Bounds x="370" y="357" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_4" bpmnElement="SubProcess_1" isExpanded="false">
<omgdc:Bounds x="501" y="357" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmndi:BPMNDiagram id="BPMNDiagram_2">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="SubProcess_1" />
</bpmndi:BPMNDiagram>
</definitions>

View File

@ -1596,6 +1596,31 @@ describe('features/modeling/rules - BpmnRules', function() {
});
describe('groups', function() {
var testXML = require('./BpmnRules.groups.bpmn');
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
describe('should resize', function() {
it('Group', inject(function(bpmnRules, elementRegistry) {
// given
var groupElement = elementRegistry.get('Group_1');
// when
var canResize = bpmnRules.canResize(groupElement);
// then
expect(canResize).to.be.true;
}));
});
});
describe('lanes', function() {
var testXML = require('./BpmnRules.collaboration-lanes.bpmn');