diff --git a/lib/features/label-editing/LabelEditingProvider.js b/lib/features/label-editing/LabelEditingProvider.js index 38b62cdf..7662707c 100644 --- a/lib/features/label-editing/LabelEditingProvider.js +++ b/lib/features/label-editing/LabelEditingProvider.js @@ -8,9 +8,11 @@ var LabelUtil = require('./LabelUtil'), DiUtil = require('../../util/Di'); -var minBounds = { +var PADDING = 4; + +var MIN_BOUNDS = { width: 150, - height: 100 + height: 50 }; @@ -60,8 +62,8 @@ LabelEditingProvider.prototype.activate = function(element) { if ((semantic.$instanceOf('bpmn:Participant') && DiUtil.isExpandedPool(semantic)) || semantic.$instanceOf('bpmn:Lane')) { - bbox.width = minBounds.width; - bbox.height = minBounds.height; + bbox.width = MIN_BOUNDS.width; + bbox.height = MIN_BOUNDS.height; bbox.x = bbox.x + 10 - bbox.width / 2; bbox.y = bbox.mid.y - bbox.height / 2; @@ -70,7 +72,7 @@ LabelEditingProvider.prototype.activate = function(element) { // adjust for sub processes if (semantic.$instanceOf('bpmn:SubProcess') && DiUtil.isExpanded(semantic, di)) { - bbox.height = minBounds.height; + bbox.height = MIN_BOUNDS.height; bbox.x = bbox.mid.x - bbox.width / 2; bbox.y = bbox.y + 10 - bbox.height / 2; @@ -82,18 +84,22 @@ LabelEditingProvider.prototype.activate = function(element) { LabelEditingProvider.prototype.getEditingBBox = function(element, maxBounds) { - var bbox = this._canvas.getAbsoluteBBox(element.label || element); + var target = element.label || element; + + var bbox = this._canvas.getAbsoluteBBox(target); var mid = { x: bbox.x + bbox.width / 2, y: bbox.y + bbox.height / 2 }; - bbox.width = Math.max(bbox.width, minBounds.width); - bbox.height = Math.max(bbox.height, minBounds.height); + // external label + if (target.labelTarget) { + bbox.width = Math.max(bbox.width, MIN_BOUNDS.width); + bbox.height = Math.max(bbox.height, MIN_BOUNDS.height); - bbox.x = mid.x - bbox.width / 2; - bbox.y = mid.y - bbox.height / 2; + bbox.x = mid.x - bbox.width / 2; + } bbox.mid = mid;