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
|
|
|
|
2022-04-06 19:38:27 +00:00
|
|
|
import inherits from 'inherits-browser';
|
2018-04-02 19:01:53 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-05-07 11:38:39 +00:00
|
|
|
* Resize shapes and lanes.
|
2016-06-08 08:49:33 +00:00
|
|
|
*
|
2019-05-07 11:38:39 +00:00
|
|
|
* @param {djs.model.Shape} target
|
|
|
|
* @param {Bounds} newBounds
|
|
|
|
* @param {Object} hints
|
2016-06-08 08:49:33 +00:00
|
|
|
*/
|
2019-04-18 11:25:53 +00:00
|
|
|
BpmnAutoResize.prototype.resize = function(target, newBounds, hints) {
|
2016-06-08 08:49:33 +00:00
|
|
|
|
|
|
|
if (is(target, 'bpmn:Participant')) {
|
2019-04-18 11:25:53 +00:00
|
|
|
this._modeling.resizeLane(target, newBounds, null, hints);
|
2016-06-08 08:49:33 +00:00
|
|
|
} else {
|
2019-04-18 11:25:53 +00:00
|
|
|
this._modeling.resizeShape(target, newBounds, null, hints);
|
2016-06-08 08:49:33 +00:00
|
|
|
}
|
|
|
|
};
|