Skip to content

Commit 8c4aa4b

Browse files
committed
Use other approximation of rectangular node radius
Use the half height instead of the half diagonal length as radius, because it's the worst case and doesn't produce too long links.
1 parent f2bbe27 commit 8c4aa4b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/webvowl/js/elements/nodes/RectangularNode.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = (function () {
99

1010
var that = this,
1111
height = 20,
12-
width = 60;
12+
width = 60,
13+
smallestRadius = height / 2;
1314

1415

1516
// Properties
@@ -29,7 +30,7 @@ module.exports = (function () {
2930
// Functions
3031
// for compatibility reasons // TODO resolve
3132
this.actualRadius = function () {
32-
return width;
33+
return smallestRadius;
3334
};
3435

3536
this.distanceToBorder = function (dx, dy) {

src/webvowl/js/elements/properties/BaseProperty.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports = (function () {
55

66
// Static variables
77
var labelHeight = 28,
8-
labelWidth = 80;
8+
labelWidth = 80,
9+
smallestRadius = labelHeight / 2;
910

1011

1112
// Constructor, private variables and privileged methods
@@ -379,7 +380,7 @@ module.exports = (function () {
379380
};
380381

381382
base.prototype.actualRadius = function() {
382-
return base.prototype.width() / 2;
383+
return smallestRadius;
383384
};
384385

385386
base.prototype.textWidth = base.prototype.width;

0 commit comments

Comments
 (0)