Add special actions for edges.

This commit is contained in:
Oleg Sh
2022-05-15 22:02:14 +02:00
parent 18eac65c92
commit 194715260d
15 changed files with 197 additions and 14 deletions

View File

@@ -1035,6 +1035,8 @@ ConnectionGraphHandler.prototype.SelectVertex = function(selectedObject)
ConnectionGraphHandler.prototype.MouseDown = function(pos)
{
$('#message').unbind();
var selectedObject = this.GetSelectedGraph(pos);
if (selectedObject && (selectedObject instanceof BaseVertex))
{
@@ -1055,7 +1057,55 @@ ConnectionGraphHandler.prototype.GetSelectedGroup = function(object)
ConnectionGraphHandler.prototype.SelectFirst = function()
{
this.firstObject = null;
let hasEdges = this.app.graph.hasEdges();
let hasDirectedEdges = this.app.graph.hasDirectEdge();
let hasUndirectedEdges = this.app.graph.hasUndirectEdge();
this.message = g_selectFisrtVertexToConnect + this.GetSelect2VertexMenu();
if (!hasEdges) {
return;
}
this.message =
". <div class=\"btn-group\" style=\"float:right; position: relative; margin-left: 8px\">"
+ "<button type=\"button\" class=\"btn btn-default btn-sm dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">"
+ g_additionlActions + " <span class=\"caret\"></span>"
+ " </button> "
+ "<ul class=\"dropdown-menu dropdown-menu-right\" style=\"z-index:15; position: absolute;\">"
+ (hasDirectedEdges ? " <li><a href=\"#\" id=\"reverseAll\">" + g_reverseAllEdges + "</a></li>" : "")
+ (hasDirectedEdges ? " <li><a href=\"#\" id=\"makeAllUndirected\">" + g_makeAllUndirected + "</a></li>" : "")
+ (hasUndirectedEdges ? " <li><a href=\"#\" id=\"makeAllDirected\">" + g_makeAllDirected + "</a></li>" : "")
+ "</ul>"
+ "</div> " + this.message;
let handler = this;
$('#message').on('click', '#reverseAll', function() {
handler.app.PushToStack("ReverseAllEdges");
handler.app.graph.reverseAllEdges();
handler.app.redrawGraph();
userAction("ReverseAllEdges");
});
$('#message').on('click', '#makeAllUndirected', function(){
handler.app.PushToStack("makeAllEdgesUndirected");
handler.app.graph.makeAllEdgesUndirected();
handler.app.redrawGraph();
userAction("makeAllEdgesUndirected");
});
$('#message').on('click', '#makeAllDirected', function(){
handler.app.PushToStack("makeAllEdgesDirected");
handler.app.graph.makeAllEdgesDirected();
handler.app.redrawGraph();
userAction("makeAllEdgesDirected");
});
}
ConnectionGraphHandler.prototype.SelectSecond = function(selectedObject)