diff --git a/lib/features/modeling/behavior/ResizeBehavior.js b/lib/features/modeling/behavior/ResizeBehavior.js index 6143f8099..eef1c7c30 100644 --- a/lib/features/modeling/behavior/ResizeBehavior.js +++ b/lib/features/modeling/behavior/ResizeBehavior.js @@ -160,10 +160,25 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala var otherTrbl = asTRBL(other); - if (/n/.test(resizeDirection)) { - if (isHorizontalLane && otherTrbl.top < (laneTrbl.top - 10)) { + // lane flags + if (isHorizontalLane) { + if (otherTrbl.top < (laneTrbl.top - 10)) { isFirst = false; } + if (otherTrbl.bottom > (laneTrbl.bottom + 10)) { + isLast = false; + } + } + else if (!isHorizontalLane) { + if (otherTrbl.left < (laneTrbl.left - 10)) { + isFirst = false; + } + if (otherTrbl.right > (laneTrbl.right + 10)) { + isLast = false; + } + } + + if (/n/.test(resizeDirection)) { // max top size (based on next element) if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) { @@ -178,10 +193,6 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala if (/e/.test(resizeDirection)) { - if (!isHorizontalLane && otherTrbl.right > (laneTrbl.right + 10)) { - isLast = false; - } - // max right size (based on previous element) if (balanced && abs(laneTrbl.right - otherTrbl.left) < 10) { addMin(maxTrbl, 'right', otherTrbl.right - minDimensions.width); @@ -195,10 +206,6 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala if (/s/.test(resizeDirection)) { - if (isHorizontalLane && otherTrbl.bottom > (laneTrbl.bottom + 10)) { - isLast = false; - } - // max bottom size (based on previous element) if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) { addMin(maxTrbl, 'bottom', otherTrbl.bottom - minDimensions.height); @@ -212,10 +219,6 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala if (/w/.test(resizeDirection)) { - if (!isHorizontalLane && otherTrbl.left < (laneTrbl.left - 10)) { - isFirst = false; - } - // max left size (based on next element) if (balanced && abs(laneTrbl.left - otherTrbl.right) < 10) { addMax(maxTrbl, 'left', otherTrbl.left + minDimensions.width); @@ -238,24 +241,23 @@ export function getParticipantResizeConstraints(laneShape, resizeDirection, bala flowElements.forEach(function(flowElement) { var flowElementTrbl = asTRBL(flowElement); - - if (isFirst && /n/.test(resizeDirection)) { + // vertical lane will resize from top with respect to flow element irrespective of first or last lane + if (/n/.test(resizeDirection) && (!isHorizontalLane || isFirst)) { addMin(minTrbl, 'top', flowElementTrbl.top - padding.top); } - - if (isLast && /e/.test(resizeDirection)) { + // horizonal lane will resize from right with respect to flow element irrespective of first or last lane + if (/e/.test(resizeDirection) && (isHorizontalLane || isLast)) { addMax(minTrbl, 'right', flowElementTrbl.right + padding.right); } - - if (isLast && /s/.test(resizeDirection)) { + // vertical lane will resize from bottom with respect to flow element irrespective of first or last lane + if (/s/.test(resizeDirection) && (!isHorizontalLane || isLast )) { addMax(minTrbl, 'bottom', flowElementTrbl.bottom + padding.bottom); } - - if (isFirst && /w/.test(resizeDirection)) { + // horizonal lane will resize from left with respect to flow element irrespective of first or last lane + if (/w/.test(resizeDirection) && (isHorizontalLane || isFirst)) { addMin(minTrbl, 'left', flowElementTrbl.left - padding.left); } }); - return { min: minTrbl, max: maxTrbl