diff --git a/lib/features/modeling/behavior/ResizeLaneBehavior.js b/lib/features/modeling/behavior/ResizeLaneBehavior.js index ee9d3ab0..92c5e533 100644 --- a/lib/features/modeling/behavior/ResizeLaneBehavior.js +++ b/lib/features/modeling/behavior/ResizeLaneBehavior.js @@ -16,6 +16,18 @@ var SLIGHTLY_HIGHER_PRIORITY = 1001; */ function ResizeLaneBehavior(eventBus, modeling) { + eventBus.on('resize.start', SLIGHTLY_HIGHER_PRIORITY + 500, function(event) { + var context = event.context, + shape = context.shape; + + if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) { + + // should we resize the opposite lane(s) in + // order to compensate for the resize operation? + context.balanced = !hasPrimaryModifier(event); + } + }); + /** * Intercept resize end and call resize lane function instead. */ @@ -23,23 +35,17 @@ function ResizeLaneBehavior(eventBus, modeling) { var context = event.context, shape = context.shape, canExecute = context.canExecute, - newBounds = context.newBounds, - balanced; + newBounds = context.newBounds; if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) { if (canExecute) { - - // should we resize the opposite lane(s) in - // order to compensate for the resize operation? - balanced = !hasPrimaryModifier(event); - // ensure we have actual pixel values for new bounds // (important when zoom level was > 1 during move) newBounds = roundBounds(newBounds); // perform the actual resize - modeling.resizeLane(shape, newBounds, balanced); + modeling.resizeLane(shape, newBounds, context.balanced); } // stop propagation diff --git a/lib/features/snapping/BpmnSnapping.js b/lib/features/snapping/BpmnSnapping.js index 654f5e7b..3d046a5d 100644 --- a/lib/features/snapping/BpmnSnapping.js +++ b/lib/features/snapping/BpmnSnapping.js @@ -230,7 +230,7 @@ function BpmnSnapping(eventBus, canvas, bpmnRules, elementRegistry) { } if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) { - context.resizeConstraints = getParticipantSizeConstraints(shape, context.direction); + context.resizeConstraints = getParticipantSizeConstraints(shape, context.direction, context.balanced); } if (is(shape, 'bpmn:TextAnnotation')) { diff --git a/lib/features/snapping/BpmnSnappingUtil.js b/lib/features/snapping/BpmnSnappingUtil.js index 9c13640f..8aa60c52 100644 --- a/lib/features/snapping/BpmnSnappingUtil.js +++ b/lib/features/snapping/BpmnSnappingUtil.js @@ -59,7 +59,7 @@ var LANE_MIN_HEIGHT = 60, LANE_BOTTOM_PADDING = 20; -function getParticipantSizeConstraints(laneShape, resizeDirection) { +function getParticipantSizeConstraints(laneShape, resizeDirection, balanced) { var lanesRoot = getLanesRoot(laneShape); @@ -93,7 +93,7 @@ function getParticipantSizeConstraints(laneShape, resizeDirection) { } // max top size (based on next element) - if (abs(laneTrbl.top - otherTrbl.bottom) < 10) { + if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) { addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_HEIGHT); } @@ -110,7 +110,7 @@ function getParticipantSizeConstraints(laneShape, resizeDirection) { } // max bottom size (based on previous element) - if (abs(laneTrbl.bottom - otherTrbl.top) < 10) { + if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) { addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_HEIGHT); }