feat(replace): auto-resize height when toggling pool collapse/expand

This commit is contained in:
Gustavo E. Jimenez Folta 2019-04-12 14:36:20 +02:00 committed by Maciej Barelkowski
parent a40b95cf2f
commit 0f7b8f483c
2 changed files with 16 additions and 6 deletions

View File

@ -67,8 +67,9 @@ function toggeling(element, target) {
* This module takes care of replacing BPMN elements
*/
export default function BpmnReplace(
bpmnFactory, replace, selection,
modeling, eventBus) {
bpmnFactory, elementFactory, replace,
selection, modeling, eventBus
) {
var helper = new ModelCloneHelper(eventBus, bpmnFactory);
@ -193,9 +194,9 @@ export default function BpmnReplace(
hints.moveChildren = false;
}
// apply same size
// apply same width and default height
newElement.width = element.width;
newElement.height = element.height;
newElement.height = elementFactory._getDefaultSize(newBusinessObject).height;
}
newBusinessObject.name = oldBusinessObject.name;
@ -234,6 +235,7 @@ export default function BpmnReplace(
BpmnReplace.$inject = [
'bpmnFactory',
'elementFactory',
'replace',
'selection',
'modeling',
@ -261,4 +263,4 @@ function intersection(a1, a2) {
return a1.filter(function(el) {
return a2.indexOf(el) !== -1;
});
}
}

View File

@ -298,6 +298,10 @@ describe('features/replace - bpmn replace', function() {
// then
expect(isExpanded(newShape)).to.be.false; // collapsed
expect(newShape.children).to.be.empty;
expect(newShape.width).to.equal(shape.width);
// default height for collapsed pool
expect(newShape.height).to.equal(100);
}));
@ -312,6 +316,10 @@ describe('features/replace - bpmn replace', function() {
// then
expect(isExpanded(newShape)).to.be.true; // expanded
expect(newShape.children).to.be.empty;
expect(newShape.width).to.equal(shape.width);
// default height for expanded pool
expect(newShape.height).to.equal(250);
}));
});
@ -1504,4 +1512,4 @@ function skipId(key, value) {
}
return value;
}
}