2018-04-02 19:01:53 +00:00
|
|
|
import AutoResize from 'diagram-js/lib/features/auto-resize/AutoResize';
|
2016-06-08 08:49:33 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import inherits from 'inherits';
|
|
|
|
|
|
|
|
import { is } from '../../util/ModelUtil';
|
2016-06-08 08:49:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sub class of the AutoResize module which implements a BPMN
|
|
|
|
* specific resize function.
|
|
|
|
*/
|
2018-04-02 19:01:53 +00:00
|
|
|
export default function BpmnAutoResize(injector) {
|
|
|
|
|
|
|
|
injector.invoke(AutoResize, this);
|
2016-06-08 08:49:33 +00:00
|
|
|
}
|
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
BpmnAutoResize.$inject = [
|
|
|
|
'injector'
|
|
|
|
];
|
2016-06-08 08:49:33 +00:00
|
|
|
|
|
|
|
inherits(BpmnAutoResize, AutoResize);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resize shapes and lanes
|
|
|
|
*
|
|
|
|
* @param {djs.model.Shape} target
|
|
|
|
* @param {Object} newBounds
|
|
|
|
*/
|
|
|
|
BpmnAutoResize.prototype.resize = function(target, newBounds) {
|
|
|
|
|
|
|
|
if (is(target, 'bpmn:Participant')) {
|
|
|
|
this._modeling.resizeLane(target, newBounds);
|
|
|
|
} else {
|
|
|
|
this._modeling.resizeShape(target, newBounds);
|
|
|
|
}
|
|
|
|
};
|