Fix save images for bent edges. Add more statistic.

This commit is contained in:
Unick Soft
2019-02-12 13:53:43 +02:00
parent b2a80c7f4f
commit 6a0e308368
5 changed files with 35 additions and 4 deletions

View File

@@ -336,11 +336,13 @@ DefaultHandler.prototype.MouseUp = function(pos)
handler.selectedObject.model.ChangeCurvedValue(DefaultHandler.prototype.curvedValue);
handler.needRedraw = true;
handler.app.redrawGraph();
userAction("Edge.Bend");
});
$('#message').on('click', '#decCurvel', function(){
handler.selectedObject.model.ChangeCurvedValue(-DefaultHandler.prototype.curvedValue);
handler.needRedraw = true;
handler.app.redrawGraph();
userAction("Edge.Bend");
});
}
}
@@ -469,7 +471,6 @@ ConnectionGraphHandler.prototype.MouseDown = function(pos)
var selectedObject = this.GetSelectedGraph(pos);
if (selectedObject && (selectedObject instanceof BaseVertex))
{
userAction("ConnectionHandler.Mouse");
this.SelectVertex(selectedObject);
}
else
@@ -498,7 +499,6 @@ ConnectionGraphHandler.prototype.SelectSecond = function(selectedObject)
ConnectionGraphHandler.prototype.SelectFirstVertexMenu = function(vertex1Text, vertex)
{
userAction("ConnectionHandler.Menu");
this.firstObject = null;
this.SelectVertex(vertex);
}
@@ -513,7 +513,6 @@ ConnectionGraphHandler.prototype.UpdateFirstVertexMenu = function(vertex1Text)
ConnectionGraphHandler.prototype.SelectSecondVertexMenu = function(vertex2Text, vertex)
{
userAction("ConnectionHandler.Menu");
this.SelectVertex(vertex);
}

View File

@@ -862,5 +862,25 @@ Graph.prototype.getGraphBBox = function (viewportSize)
pointMax = pointMax.max(vertex.position.add(deltaVector));
}
var max_cruvled_length = 32;
for(i = 0; i < this.edges.length; i++)
{
var edge = this.edges[i];
if (edge.model.type == EdgeModels.cruvled)
{
var max_cruvled = edge.vertex2.position.subtract(edge.vertex1.position).length() / max_cruvled_length;
for (j = 0; j < max_cruvled; j++)
{
var point = edge.model.GetCurvedPoint(edge.vertex1.position, edge.vertex2.position, j / max_cruvled);
var deltaVector = new Point(max_cruvled_length, max_cruvled_length);
pointMin = pointMin.min(point.subtract(deltaVector));
pointMax = pointMax.max(point.add(deltaVector));
}
}
}
return new Rect(pointMin, pointMax);
}