Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function computeChildrenBBox(shape, padding) {
// grab all the children that are part of the
// parents children box
var elements = filter(shape.children, function(element) {
return isBBoxChild(shape, element);
});
if (elements.length) {
return ResizeUtil.addPadding(getBBox(elements), padding);
}
}
minDimensions = context.minDimensions || {
width: 100,
height: topBandsHeight + bottomBandsHeight + 40
};
// get children we want to factor in in determining the bounds (only when not collapsed)
let childrenBounds;
if (!shape.collapsed) {
childrenBounds = getChildrenBBox(shape);
if (childrenBounds) {
// add padding from context
childrenBounds = addPadding(childrenBounds, context.childrenBoxPadding);
// add padding for the bands
childrenBounds = addPadding(childrenBounds, {
left: 0,
right: 0,
top: heightOfTopBands(shape),
bottom: heightOfBottomBands(shape)
});
}
}
return getMinResizeBounds(direction, shape, minDimensions, childrenBounds);
}
return Resize.prototype.computeMinResizeBox.call(this, context);
};
if (is(shape, 'bpmn:ChoreographyActivity')) {
let topBandsHeight = heightOfTopBands(shape);
let bottomBandsHeight = heightOfBottomBands(shape);
minDimensions = context.minDimensions || {
width: 100,
height: topBandsHeight + bottomBandsHeight + 40
};
// get children we want to factor in in determining the bounds (only when not collapsed)
let childrenBounds;
if (!shape.collapsed) {
childrenBounds = getChildrenBBox(shape);
if (childrenBounds) {
// add padding from context
childrenBounds = addPadding(childrenBounds, context.childrenBoxPadding);
// add padding for the bands
childrenBounds = addPadding(childrenBounds, {
left: 0,
right: 0,
top: heightOfTopBands(shape),
bottom: heightOfBottomBands(shape)
});
}
}
return getMinResizeBounds(direction, shape, minDimensions, childrenBounds);
}
return Resize.prototype.computeMinResizeBox.call(this, context);
};
function expandedBounds(shape, defaultSize) {
let bounds = getChildrenBBox(shape);
if (bounds) {
bounds = addPadding(bounds, {
left: 0,
right: 0,
top: heightOfTopBands(shape),
bottom: heightOfBottomBands(shape)
});
bounds = addPadding(bounds, 20);
return bounds;
} else {
return {
x: shape.x + (shape.width - defaultSize.width) / 2,
y: shape.y + (shape.height - defaultSize.height) / 2,
width: defaultSize.width,
height: defaultSize.height
};
}
}
function expandedBounds(shape, defaultSize) {
let bounds = getChildrenBBox(shape);
if (bounds) {
bounds = addPadding(bounds, {
left: 0,
right: 0,
top: heightOfTopBands(shape),
bottom: heightOfBottomBands(shape)
});
bounds = addPadding(bounds, 20);
return bounds;
} else {
return {
x: shape.x + (shape.width - defaultSize.width) / 2,
y: shape.y + (shape.height - defaultSize.height) / 2,
width: defaultSize.width,
height: defaultSize.height
};
}
}