diff --git a/lang/en/home.php b/lang/en/home.php
index 6c9e67e..3d27b6a 100755
--- a/lang/en/home.php
+++ b/lang/en/home.php
@@ -27,7 +27,7 @@
"";
$g_lang["select_first_vertext_to_connect"] = "Select first vertex of edge";
- $g_lang["select_second_vertext_to_connect"] = "Select second vertext of edge";
+ $g_lang["select_second_vertext_to_connect"] = "Select second vertex of edge";
$g_lang["select_start_short_path_vertex"] = "Select the initial vertex of the shortest path";
$g_lang["select_finish_short_path_vertex"] = "Select the end vertex of the shortest path";
$g_lang["short_path_result"] = "Shortest path length is %d";
diff --git a/script/EventHandlers.js b/script/EventHandlers.js
index 2395446..c039d0f 100644
--- a/script/EventHandlers.js
+++ b/script/EventHandlers.js
@@ -1058,60 +1058,15 @@ 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_selectFirstVertexToConnect + this.GetSelect2VertexMenu();
-
- if (!hasEdges) {
- return;
- }
-
- this.message =
- ".
"
- + " "
- + ""
- + "
" + 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");
- });
+ this.message = this.AppendSpecialSctionsButton(this.message);
}
ConnectionGraphHandler.prototype.SelectSecond = function(selectedObject)
{
this.firstObject = selectedObject;
- this.message = g_selectSecondVertexToConnect + this.GetSelect2VertexMenu();
+ this.message = g_selectSecondVertexToConnect + this.GetSelect2VertexMenu();
+ this.message = this.AppendSpecialSctionsButton(this.message);
}
ConnectionGraphHandler.prototype.SelectFirstVertexMenu = function(vertex1Text, vertex)
@@ -1141,6 +1096,55 @@ ConnectionGraphHandler.prototype.UpdateSecondVertexMenu = function(vertex2Text)
}
}
+ConnectionGraphHandler.prototype.AppendSpecialSctionsButton = function(baseMessage)
+{
+ let hasEdges = this.app.graph.hasEdges();
+
+ if (!hasEdges) return baseMessage;
+
+ let hasDirectedEdges = this.app.graph.hasDirectEdge();
+ let hasUndirectedEdges = this.app.graph.hasUndirectEdge();
+
+ 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");
+ });
+
+ return ""
+ + " "
+ + ""
+ + "
" + baseMessage;
+}
+
+
/**
* Delete Graph handler.
*
diff --git a/tpl/home.php b/tpl/home.php
index 2eb4d3a..8fb6a23 100755
--- a/tpl/home.php
+++ b/tpl/home.php
@@ -11,7 +11,7 @@
-
+