mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-11 17:44:12 +00:00
feat(modeling): allow to drag participant via nested lane
Related to https://github.com/bpmn-io/bpmn-js/issues/957
This commit is contained in:
parent
7b0e304062
commit
fdb299dc88
@ -5,6 +5,8 @@ import { is } from '../../../util/ModelUtil';
|
||||
import { isAny } from '../util/ModelingUtil';
|
||||
|
||||
var HIGH_PRIORITY = 1500;
|
||||
var HIGHEST_PRIORITY = 2000;
|
||||
|
||||
|
||||
/**
|
||||
* Correct hover targets in certain situations to improve diagram interaction.
|
||||
@ -90,6 +92,16 @@ export default function FixHoverBehavior(elementRegistry, eventBus, canvas) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// allow movement of participants from lanes
|
||||
eventBus.on('shape.move.start', HIGHEST_PRIORITY, function(event) {
|
||||
var shape = event.shape;
|
||||
|
||||
if (is(shape, 'bpmn:Lane')) {
|
||||
event.shape = getLanesRoot(shape) || shape;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
FixHoverBehavior.$inject = [
|
||||
|
@ -382,4 +382,56 @@ describe('features/modeling/behavior - fix hover', function() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('participant with lane', function() {
|
||||
|
||||
var diagramXML = require('./FixHoverBehavior.lane-connect.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules.concat([
|
||||
globalConnectModule,
|
||||
bendpointsModule
|
||||
])
|
||||
}));
|
||||
|
||||
beforeEach(inject(function(dragging) {
|
||||
dragging.setOptions({ manual: true });
|
||||
}));
|
||||
|
||||
|
||||
it('should move the participant when lane is dragged', inject(
|
||||
function(canvas, eventBus, elementRegistry, move, dragging) {
|
||||
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_1'),
|
||||
participant = elementRegistry.get('Participant_Lanes');
|
||||
|
||||
var rootElement = canvas.getRootElement(),
|
||||
rootElementGfx = canvas.getGraphics(rootElement);
|
||||
|
||||
var moveEndSpy = spy(function(event) {
|
||||
expect(event.context.shape).to.equal(participant);
|
||||
});
|
||||
|
||||
eventBus.on('shape.move.end', moveEndSpy);
|
||||
|
||||
// when
|
||||
move.start(canvasEvent({ x: 100, y: 100 }), lane);
|
||||
|
||||
dragging.move(canvasEvent({ x: 140, y: 120 }));
|
||||
|
||||
dragging.hover({
|
||||
element: rootElement,
|
||||
gfx: rootElementGfx
|
||||
});
|
||||
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
expect(moveEndSpy).to.have.been.calledOnce;
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user