fix(label-editing): resize empty text annotations on complete
Related to bpmn-io/diagram-js-direct-editing#12
This commit is contained in:
parent
96cd55a2c6
commit
e4e789bd3e
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
||||
});
|
Loading…
Reference in New Issue