diff --git a/script/BaseEdgeDrawer.js b/script/BaseEdgeDrawer.js
index c984e85..4898fcf 100644
--- a/script/BaseEdgeDrawer.js
+++ b/script/BaseEdgeDrawer.js
@@ -434,8 +434,10 @@ BaseEdgeDrawer.prototype.GetTextCenterPoint = function (position1, position2, ha
var centerPoint = Point.interpolate(position1, position2, 0.5);
if (position1.equals(position2))
{
- centerPoint.y = centerPoint.y - Math.cos(this.model.GetLoopShiftAngel()) * this.model.GetLoopSize() * 2;
- centerPoint.x = centerPoint.x - Math.sin(this.model.GetLoopShiftAngel()) * this.model.GetLoopSize() * 2;
+ let sinVal = Math.sin(this.model.GetLoopShiftAngel());
+ let cosVal = Math.cos(this.model.GetLoopShiftAngel());
+ centerPoint.x = centerPoint.x - cosVal * this.model.GetLoopSize();
+ centerPoint.y = centerPoint.y - (sinVal + Math.sign(sinVal) * 1.0) * this.model.GetLoopSize();
}
return centerPoint;
@@ -547,8 +549,10 @@ CurvedArcDrawer.prototype.GetTextCenterPoint = function (position1, position2, h
var centerPoint = this.model.GetCurvePoint(position1, position2, 0.5)
if (position1.equals(position2))
{
- centerPoint.y = centerPoint.y - Math.cos(this.model.GetLoopShiftAngel()) * this.model.GetLoopSize() * 2;
- centerPoint.x = centerPoint.x - Math.sin(this.model.GetLoopShiftAngel()) * this.model.GetLoopSize() * 2;
+ let sinVal = Math.sin(this.model.GetLoopShiftAngel());
+ let cosVal = Math.cos(this.model.GetLoopShiftAngel());
+ centerPoint.x = centerPoint.x - cosVal * this.model.GetLoopSize();
+ centerPoint.y = centerPoint.y - (sinVal + Math.sign(sinVal) * 1.0) * this.model.GetLoopSize();
}
return centerPoint;
diff --git a/script/EdgeModel.js b/script/EdgeModel.js
index 7ff32fa..88a5988 100755
--- a/script/EdgeModel.js
+++ b/script/EdgeModel.js
@@ -205,19 +205,29 @@ EdgeModel.prototype.SetCurveValue = function (value)
EdgeModel.prototype.GetLoopSize = function ()
{
if (Math.abs(this.curveValue) <= 0.01)
- { // without this condition arc disappears when curveValue=0
+ {
+ // without this condition arc disappears when curveValue=0
return this.sizeOfLoop;
}
else
- { // bigger curveValue -> bigger loop size
- return this.sizeOfLoop*Math.abs(this.curveValue)*(1/this.defaultCurve);
+ {
+ // bigger curveValue -> bigger loop size
+ let normalCurve = this.curveValue;
+ if (this.type == EdgeModels.line) {
+ normalCurve = this.defaultCurve;
+ }
+ else if (normalCurve >= 0.0) {
+ normalCurve += this.defaultCurve
+ }
+
+ return this.sizeOfLoop * Math.abs(normalCurve) * (1 / this.defaultCurve);
}
}
EdgeModel.prototype.GetLoopShiftAngel = function ()
{
- if (this.curveValue > 0)
+ if (this.type == EdgeModels.line || this.curveValue >= 0.0)
{ // shift to top-left
return this.loopShiftAngel;
}
diff --git a/tpl/home.php b/tpl/home.php
index e446d74..fa2a2c1 100755
--- a/tpl/home.php
+++ b/tpl/home.php
@@ -11,7 +11,7 @@
-
+