chore(labels): set label above sequence flow
Allign for most common 'yes/no' labels - set label close to right side
This commit is contained in:
parent
7811a47fae
commit
690881491d
|
@ -9,6 +9,8 @@ var DEFAULT_LABEL_SIZE = module.exports.DEFAULT_LABEL_SIZE = {
|
|||
height: 20
|
||||
};
|
||||
|
||||
var FLOW_LABEL_INDENT = module.exports.FLOW_LABEL_INDENT = 15;
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the given semantic has an external label
|
||||
|
@ -49,9 +51,9 @@ function getFlowLabelPosition(waypoints) {
|
|||
y = position.y;
|
||||
|
||||
if ( Math.abs(angle) < Math.PI / 2 ) {
|
||||
y += DEFAULT_LABEL_SIZE.height / 2;
|
||||
y -= FLOW_LABEL_INDENT;
|
||||
} else {
|
||||
x += DEFAULT_LABEL_SIZE.width / 2;
|
||||
x += FLOW_LABEL_INDENT;
|
||||
}
|
||||
|
||||
return { x: x, y: y };
|
||||
|
|
|
@ -7,9 +7,6 @@ require('../../TestHelper');
|
|||
var coreModule = require('../../../lib/core'),
|
||||
modelingModule = require('../../../lib/features/modeling');
|
||||
|
||||
var ModelUtil = require('../../../lib/util/ModelUtil'),
|
||||
LabelUtil = require('../../../lib/util/LabelUtil');
|
||||
|
||||
|
||||
describe('LabelUtil', function() {
|
||||
|
||||
|
@ -29,7 +26,7 @@ describe('LabelUtil', function() {
|
|||
|
||||
// then
|
||||
expect(connection.label.x).to.be.equal(427);
|
||||
expect(connection.label.y).to.be.equal(357);
|
||||
expect(connection.label.y).to.be.equal(332);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -43,7 +40,7 @@ describe('LabelUtil', function() {
|
|||
var connection = modeling.connect(element1, element2);
|
||||
|
||||
// then
|
||||
expect(connection.label.x).to.be.equal(322);
|
||||
expect(connection.label.x).to.be.equal(292);
|
||||
expect(connection.label.y).to.be.equal(219.5);
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in New Issue