fix(label-editing): resize empty text annotations on complete

Related to bpmn-io/diagram-js-direct-editing#12
This commit is contained in:
Philipp Fromme 2020-03-10 14:35:39 +01:00
parent 96cd55a2c6
commit e4e789bd3e
2 changed files with 16 additions and 6 deletions

View File

@ -104,11 +104,6 @@ export default function UpdateLabelHandler(modeling, textRenderer) {
var text = getLabel(label);
// don't resize without text
if (!text) {
return;
}
// resize element based on label _or_ pre-defined bounds
if (typeof newBounds === 'undefined') {
newBounds = textRenderer.getExternalLabelBounds(label, text);

View File

@ -20,7 +20,7 @@ describe('features/modeling - update label', function() {
it('should change name of start event', inject(
function(modeling, elementRegistry, eventBus) {
function(modeling, elementRegistry) {
// given
var startEvent_1 = elementRegistry.get('StartEvent_1');
@ -190,4 +190,19 @@ describe('features/modeling - update label', function() {
}
));
it('should resize empty text annotation', inject(function(modeling, elementRegistry) {
// given
var element = elementRegistry.get('TextAnnotation_1');
var newBounds = { x: 100, y: 100, width: 100, height: 30 };
// when
modeling.updateLabel(element, null, newBounds);
// then
expect(element).to.have.bounds(newBounds);
}));
});