Skip to content

Commit

Permalink
fix: ensure lanes aren't resized when using space tool
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Oct 12, 2023
1 parent e871115 commit 4f6923b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/features/modeling/behavior/FixHoverBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ export default function FixHoverBehavior(elementRegistry, eventBus, canvas) {
}
});

// ensure lanes aren't resized without their parent participant when using
// space tool
eventBus.on('spaceTool.move', HIGHEST_PRIORITY, function(event) {
var hover = event.hover;

if (hover && is(hover, 'bpmn:Lane')) {
event.hover = getLanesRoot(hover);
}
});

}

FixHoverBehavior.$inject = [
Expand Down
42 changes: 42 additions & 0 deletions test/spec/features/modeling/behavior/FixHoverBehaviorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,46 @@ describe('features/modeling/behavior - fix hover', function() {

});


describe('space tool', function() {

var diagramXML = require('./FixHoverBehavior.participant.bpmn');

beforeEach(bootstrapModeler(diagramXML, {
modules: testModules
}));

beforeEach(inject(function(dragging) {
dragging.setOptions({ manual: true });
}));


it('should <spaceTool.move> participant', inject(
function(dragging, elementRegistry, spaceTool) {

// given
var lane = elementRegistry.get('Lane_1'),
participant = elementRegistry.get('Participant_1');

spaceTool.activateMakeSpace(canvasEvent({ x: 150, y: 0 }));

expect(participant.width).to.equal(600);

// when
dragging.hover({ element: lane });

dragging.move(canvasEvent({ x: 250, y: 0 }, {
button: 0,
shiftKey: true
}));

dragging.end();

// then
expect(participant.width).to.equal(700);
}
));

});

});

0 comments on commit 4f6923b

Please sign in to comment.