mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-11 08:26:32 +00:00
38 lines
961 B
JavaScript
38 lines
961 B
JavaScript
|
import { getLanesRoot } from '../util/LaneUtil';
|
||
|
|
||
|
import { is } from '../../../util/ModelUtil';
|
||
|
|
||
|
import { isAny } from '../util/ModelingUtil';
|
||
|
|
||
|
var HIGH_PRIORITY = 1500;
|
||
|
|
||
|
/**
|
||
|
* Ensure hovering participant during create and move.
|
||
|
*
|
||
|
* @param {ElementRegistry} elementRegistry
|
||
|
* @param {EventBus} eventBus
|
||
|
*/
|
||
|
export default function CreateBehavior(elementRegistry, eventBus) {
|
||
|
eventBus.on([
|
||
|
'create.hover',
|
||
|
'create.move',
|
||
|
'create.end',
|
||
|
'shape.move.hover',
|
||
|
'shape.move.move',
|
||
|
'shape.move.end'
|
||
|
], HIGH_PRIORITY, function(event) {
|
||
|
var context = event.context,
|
||
|
shape = context.shape,
|
||
|
hover = event.hover;
|
||
|
|
||
|
if (is(hover, 'bpmn:Lane') && !isAny(shape, [ 'bpmn:Lane', 'bpmn:Participant' ])) {
|
||
|
event.hover = getLanesRoot(hover);
|
||
|
event.hoverGfx = elementRegistry.getGraphics(event.hover);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
CreateBehavior.$inject = [
|
||
|
'elementRegistry',
|
||
|
'eventBus'
|
||
|
];
|