Skip to content

Commit

Permalink
improvement(replace): auto-resize height when collapsing expanded pool
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavjf committed Apr 23, 2019
1 parent a40b95c commit a7c7d43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 7 additions & 5 deletions lib/features/replace/BpmnReplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -234,6 +235,7 @@ export default function BpmnReplace(

BpmnReplace.$inject = [
'bpmnFactory',
'elementFactory',
'replace',
'selection',
'modeling',
Expand Down Expand Up @@ -261,4 +263,4 @@ function intersection(a1, a2) {
return a1.filter(function(el) {
return a2.indexOf(el) !== -1;
});
}
}
10 changes: 9 additions & 1 deletion test/spec/features/replace/BpmnReplaceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}));


Expand All @@ -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);
}));

});
Expand Down Expand Up @@ -1504,4 +1512,4 @@ function skipId(key, value) {
}

return value;
}
}

0 comments on commit a7c7d43

Please sign in to comment.