Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should constrain ' + JSON.stringify(position), inject(function(dragging) {
// when
dragging.move(canvasEvent(position));
dragging.end();
// then
expectBoundsWithin(
asTRBL(getBBox(participant.children)),
asTRBL(getBBox(participant)),
padding
);
}));
it('should move to origin', inject(function(editorActions) {
// given
var elements = editorActions.trigger('selectElements'),
boundingBox;
// when
editorActions.trigger('moveToOrigin');
boundingBox = getBBox(elements);
// then
expect(pick(boundingBox, [ 'x', 'y' ])).to.eql({ x: 0, y: 0 });
}));
it('should constrain ' + JSON.stringify(position), inject(function(dragging) {
// when
dragging.move(canvasEvent(position));
dragging.end();
// then
expectBoundsWithin(
asTRBL(getBBox(participant.children)),
asTRBL(getBBox(participant)),
padding
);
}));
function expand(elements, target) {
if (typeof target === 'string') {
target = elementRegistry.get(target);
}
var bbox = getBoundingBox(elements),
canExpand = true;
if (!is(target, 'bpmn:Participant') && !is(target, 'bpmn:Lane') && !(is(target, 'bpmn:SubProcess'))) {
return;
}
forEach(elements, function(element) {
if (is(element, 'bpmn:Lane') || element.labelTarget) {
canExpand = false;
return;
}
});
if (!canExpand) {
return;
this._registerAction('moveToOrigin', function() {
var rootElement = canvas.getRootElement(),
boundingBox,
elements;
if (is(rootElement, 'bpmn:Collaboration')) {
elements = elementRegistry.filter(function(element) {
return is(element.parent, 'bpmn:Collaboration');
});
} else {
elements = elementRegistry.filter(function(element) {
return element !== rootElement && !is(element.parent, 'bpmn:SubProcess');
});
}
boundingBox = getBBox(elements);
modeling.moveElements(
elements,
{ x: -boundingBox.x, y: -boundingBox.y },
rootElement
);
});
}