parent
f29793ed9e
commit
629239f93c
|
@ -118,6 +118,13 @@ function AutoResize(eventBus, canvas, modeling){
|
|||
}
|
||||
|
||||
modeling.resizeShape(target, newBounds);
|
||||
|
||||
var parent = target.parent;
|
||||
|
||||
// recursively expand parent elements
|
||||
if (parent) {
|
||||
expand([target], parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
|
||||
<bpmn:process id="Process_1" isExecutable="false">
|
||||
<bpmn:subProcess id="SubProcess_1">
|
||||
<bpmn:subProcess id="SubProcess_2">
|
||||
<bpmn:subProcess id="SubProcess_3">
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:task id="Task_1">
|
||||
<bpmn:incoming>SequenceFlow_1</bpmn:incoming>
|
||||
</bpmn:task>
|
||||
<bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="StartEvent_1" targetRef="Task_1" />
|
||||
</bpmn:subProcess>
|
||||
</bpmn:subProcess>
|
||||
</bpmn:subProcess>
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||
<bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
|
||||
<dc:Bounds x="106" y="74" width="574" height="257" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="SubProcess_2_di" bpmnElement="SubProcess_2" isExpanded="true">
|
||||
<dc:Bounds x="126" y="94" width="528" height="212" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="SubProcess_3_di" bpmnElement="SubProcess_3" isExpanded="true">
|
||||
<dc:Bounds x="146" y="114" width="481" height="165" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="181" y="175" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="154" y="211" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
|
||||
<dc:Bounds x="481" y="153" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1">
|
||||
<di:waypoint xsi:type="dc:Point" x="217" y="193" />
|
||||
<di:waypoint xsi:type="dc:Point" x="481" y="193" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="304" y="183" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
|
@ -14,7 +14,7 @@ var autoResizeModule = require('../../../../lib/features/auto-resize'),
|
|||
canvasEvent = require('../../../util/MockEvents').createCanvasEvent;
|
||||
|
||||
function getBounds(shape) {
|
||||
return pick(shape, ['x', 'y', 'width', 'height']);
|
||||
return pick(shape, [ 'x', 'y', 'width', 'height' ]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,7 +217,6 @@ describe('features/auto-resize', function() {
|
|||
var expectedBounds = assign(originalBounds, { width: 563, height: 290 });
|
||||
|
||||
expect(participant).to.have.bounds(expectedBounds);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -275,7 +274,6 @@ describe('features/auto-resize', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('lane', function() {
|
||||
|
||||
var diagramXML = require('./AutoResize.lanes.bpmn');
|
||||
|
@ -316,7 +314,6 @@ describe('features/auto-resize', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('sub processes', function() {
|
||||
|
||||
var diagramXML = require('./AutoResize.sub-processes.bpmn');
|
||||
|
@ -421,4 +418,42 @@ describe('features/auto-resize', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('nested sub processes', function() {
|
||||
|
||||
var diagramXML = require('./AutoResize.nested-sub-processes.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
it('should recursively expand parent element', inject(function(elementRegistry, modeling){
|
||||
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
subProcessShape_2 = elementRegistry.get('SubProcess_2'),
|
||||
subProcessShape_3 = elementRegistry.get('SubProcess_3');
|
||||
|
||||
var originalBounds = getBounds(subProcessShape_2);
|
||||
|
||||
modeling.moveElements([taskShape], { x: 100, y: 0 }, subProcessShape_3);
|
||||
|
||||
var expectedBounds = assign(originalBounds, { width: 755 });
|
||||
|
||||
expect(subProcessShape_2).to.have.bounds(expectedBounds);
|
||||
}));
|
||||
|
||||
it('should recursively expand last parent element', inject(function(elementRegistry, modeling){
|
||||
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
subProcessShape_1 = elementRegistry.get('SubProcess_1'),
|
||||
subProcessShape_3 = elementRegistry.get('SubProcess_3');
|
||||
|
||||
var originalBounds = getBounds(subProcessShape_1);
|
||||
|
||||
modeling.moveElements([ taskShape ], { x: 100, y: 0 }, subProcessShape_3);
|
||||
|
||||
var expectedBounds = assign(originalBounds, { width: 875 });
|
||||
|
||||
expect(subProcessShape_1).to.have.bounds(expectedBounds);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue