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:
Vladimirs Katusenoks 2016-04-20 15:40:40 +02:00
parent 7811a47fae
commit 690881491d
2 changed files with 6 additions and 7 deletions

View File

@ -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 };

View File

@ -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);
}));