chore(auto-place): improve TextAnnotation and DataElement locations

Related to #563
This commit is contained in:
Nico Rehwaldt 2017-12-15 10:34:11 +01:00
parent a845560425
commit 718836f53e
2 changed files with 13 additions and 6 deletions

View File

@ -158,14 +158,14 @@ function getTextAnnotationPosition(source, element) {
var sourceTrbl = asTRBL(source); var sourceTrbl = asTRBL(source);
var position = { var position = {
x: sourceTrbl.right + 30 + element.width / 2, x: sourceTrbl.right + element.width / 2,
y: sourceTrbl.top - 50 - element.height / 2 y: sourceTrbl.top - 50 - element.height / 2
}; };
var escapeDirection = { var escapeDirection = {
y: { y: {
margin: -30, margin: -30,
rowSize: 30 rowSize: 20
} }
}; };
@ -183,14 +183,14 @@ function getDataElementPosition(source, element) {
var sourceTrbl = asTRBL(source); var sourceTrbl = asTRBL(source);
var position = { var position = {
x: sourceTrbl.right + 50 + element.width / 2, x: sourceTrbl.right - 10 + element.width / 2,
y: sourceTrbl.bottom + 40 + element.width / 2 y: sourceTrbl.bottom + 40 + element.width / 2
}; };
var escapeDirection = { var escapeDirection = {
x: { x: {
margin: 30, margin: 30,
rowSize: 80 rowSize: 30
} }
}; };

View File

@ -104,6 +104,13 @@ describe('features/auto-place', function() {
describe('should place bpmn:DataStoreReference', function() { describe('should place bpmn:DataStoreReference', function() {
it('bottom right of source', autoPlace({ it('bottom right of source', autoPlace({
element: 'bpmn:DataStoreReference',
behind: 'TASK_2',
expectedBounds: { x: 369, y: 303, width: 50, height: 50 }
}));
it('next to existing', autoPlace({
element: 'bpmn:DataStoreReference', element: 'bpmn:DataStoreReference',
behind: 'TASK_3', behind: 'TASK_3',
expectedBounds: { x: 769, y: 247, width: 50, height: 50 } expectedBounds: { x: 769, y: 247, width: 50, height: 50 }
@ -117,14 +124,14 @@ describe('features/auto-place', function() {
it('top right of source', autoPlace({ it('top right of source', autoPlace({
element: 'bpmn:TextAnnotation', element: 'bpmn:TextAnnotation',
behind: 'TASK_2', behind: 'TASK_2',
expectedBounds: { x: 409, y: 103, width: 100, height: 30 } expectedBounds: { x: 379, y: 103, width: 100, height: 30 }
})); }));
it('above existing', autoPlace({ it('above existing', autoPlace({
element: 'bpmn:TextAnnotation', element: 'bpmn:TextAnnotation',
behind: 'TASK_3', behind: 'TASK_3',
expectedBounds: { x: 726, y: -4, width: 100, height: 30 } expectedBounds: { x: 696, y: -4, width: 100, height: 30 }
})); }));
}); });