Skip to content

Commit

Permalink
chore(modeling/label): adjust label position to laid out connection
Browse files Browse the repository at this point in the history
Closes #718
  • Loading branch information
barmac authored and nikku committed Apr 18, 2019
1 parent 6c5a370 commit 02c03a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/features/modeling/behavior/LabelBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ export default function LabelBehavior(

function getVisibleLabelAdjustment(event) {

var command = event.command,
context = event.context,
var context = event.context,
connection = context.connection,
label = connection.label,
hints = assign({}, context.hints),
Expand All @@ -163,11 +162,11 @@ export default function LabelBehavior(


if (typeof hints.startChanged === 'undefined') {
hints.startChanged = (command === 'connection.reconnectStart');
hints.startChanged = !!hints.connectionStart;
}

if (typeof hints.endChanged === 'undefined') {
hints.endChanged = (command === 'connection.reconnectEnd');
hints.endChanged = !!hints.connectionEnd;
}

return getLabelAdjustment(label, newWaypoints, oldWaypoints, hints);
Expand Down
4 changes: 2 additions & 2 deletions test/spec/features/modeling/LabelLayoutingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ describe('modeling - label layouting', function() {
modeling.reconnectEnd(connection, shape, { x: 294, y: 270 });

// then
expect(Math.round(connection.label.x)).to.be.within(224, 228);
expect(Math.round(connection.label.y)).to.be.within(93, 97);
expect(Math.round(connection.label.x)).to.be.within(257, 270);
expect(Math.round(connection.label.y)).to.be.within(240, 250);

}));

Expand Down

0 comments on commit 02c03a7

Please sign in to comment.