David Benson 2020-11-11 12:44:27 +00:00 committed by GitHub
parent 5d4f1976e9
commit 82321b3496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -2099,20 +2099,20 @@ mxGraphView.prototype.getRelativePoint = function(edgeState, x, y)
var totalLength = edgeState.length;
var segments = edgeState.segments;
// Works which line segment the point of the label is closest to
// Works out which line segment the point of the label is closest to
var p0 = edgeState.absolutePoints[0];
var pe = edgeState.absolutePoints[1];
var minDist = mxUtils.ptSegDistSq(p0.x, p0.y, pe.x, pe.y, x, y);
var length = 0;
var index = 0;
var tmp = 0;
var length = 0;
for (var i = 2; i < pointCount; i++)
{
tmp += segments[i - 2];
p0 = pe;
pe = edgeState.absolutePoints[i];
var dist = mxUtils.ptSegDistSq(p0.x, p0.y, pe.x, pe.y, x, y);
tmp += segments[i - 2];
if (dist <= minDist)
{
@ -2120,8 +2120,6 @@ mxGraphView.prototype.getRelativePoint = function(edgeState, x, y)
index = i - 1;
length = tmp;
}
p0 = pe;
}
var seg = segments[index];