mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-11 17:44:12 +00:00
parent
0044a51bc5
commit
a1044e2784
@ -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.mid = mid;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user