mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-18 04:51:10 +00:00
390031a7c3
* update embedded label bounds on shape move * remove embedded label bounds on shape resize Related to https: //github.com/camunda/camunda-modeler/issues/2591 Co-Authored-By: Martin Stamm <martin.stamm@camunda.com> Co-Authored-By: Philipp Fromme <philippfromme@outlook.com>
34 lines
868 B
JavaScript
34 lines
868 B
JavaScript
import inherits from 'inherits';
|
|
|
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
|
|
import { getDi } from '../../../util/ModelUtil';
|
|
|
|
/**
|
|
* BPMN specific behavior ensuring that bpmndi:Label's dc:Bounds are removed
|
|
* when shape is resized.
|
|
*/
|
|
export default function RemoveEmbeddedLabelBoundsBehavior(eventBus, modeling) {
|
|
CommandInterceptor.call(this, eventBus);
|
|
|
|
this.preExecute(['shape.resize'], function(context) {
|
|
var shape = context.shape;
|
|
|
|
var di = getDi(shape),
|
|
label = di && di.get('label'),
|
|
bounds = label && label.get('bounds');
|
|
|
|
if (bounds) {
|
|
modeling.updateModdleProperties(shape, label, {
|
|
bounds: undefined
|
|
});
|
|
}
|
|
}, true);
|
|
}
|
|
|
|
inherits(RemoveEmbeddedLabelBoundsBehavior, CommandInterceptor);
|
|
|
|
RemoveEmbeddedLabelBoundsBehavior.$inject = [
|
|
'eventBus',
|
|
'modeling'
|
|
]; |