chore(modeling/label): adjust label position to laid out connection

Closes #718
This commit is contained in:
Maciej Barelkowski 2019-04-18 15:09:44 +02:00 committed by merge-me[bot]
parent 6c191590b5
commit 55ca4c8f3d
2 changed files with 5 additions and 6 deletions

View File

@ -153,8 +153,7 @@ export default function LabelBehavior(
function getVisibleLabelAdjustment(event) { function getVisibleLabelAdjustment(event) {
var command = event.command, var context = event.context,
context = event.context,
connection = context.connection, connection = context.connection,
label = connection.label, label = connection.label,
hints = assign({}, context.hints), hints = assign({}, context.hints),
@ -163,11 +162,11 @@ export default function LabelBehavior(
if (typeof hints.startChanged === 'undefined') { if (typeof hints.startChanged === 'undefined') {
hints.startChanged = (command === 'connection.reconnectStart'); hints.startChanged = !!hints.connectionStart;
} }
if (typeof hints.endChanged === 'undefined') { if (typeof hints.endChanged === 'undefined') {
hints.endChanged = (command === 'connection.reconnectEnd'); hints.endChanged = !!hints.connectionEnd;
} }
return getLabelAdjustment(label, newWaypoints, oldWaypoints, hints); return getLabelAdjustment(label, newWaypoints, oldWaypoints, hints);

View File

@ -255,8 +255,8 @@ describe('modeling - label layouting', function() {
modeling.reconnectEnd(connection, shape, { x: 294, y: 270 }); modeling.reconnectEnd(connection, shape, { x: 294, y: 270 });
// then // then
expect(Math.round(connection.label.x)).to.be.within(224, 228); expect(Math.round(connection.label.x)).to.be.within(257, 270);
expect(Math.round(connection.label.y)).to.be.within(93, 97); expect(Math.round(connection.label.y)).to.be.within(240, 250);
})); }));