Fix context menu.

This commit is contained in:
Oleg Sh 2022-03-09 20:19:34 +02:00
parent 02ee85a6e7
commit e4eed18568
2 changed files with 15 additions and 11 deletions

View File

@ -10,12 +10,12 @@
* *
*/ */
function BaseHandler(app, removeStack) function BaseHandler(app)
{ {
this.app = app; this.app = app;
this.app.setRenderPath([]); this.app.setRenderPath([]);
if (removeStack) { if (this.removeStack) {
this.removeContextMenu(); this.removeContextMenu();
} }
this.contextMenuObject = null; this.contextMenuObject = null;
@ -259,7 +259,7 @@ BaseHandler.prototype.addContextMenu = function()
} }
}); });
$("#Context_Add_Edge").click(function() { $("#Context_Add_Vertex").click(function() {
handler.app.PushToStack("Add"); handler.app.PushToStack("Add");
handler.app.CreateNewGraph(handler.contextMenuPoint.x, handler.contextMenuPoint.y); handler.app.CreateNewGraph(handler.contextMenuPoint.x, handler.contextMenuPoint.y);
handler.app.redrawGraph(); handler.app.redrawGraph();
@ -313,7 +313,7 @@ BaseHandler.prototype.removeContextMenu = function()
$("#Context_Connect").off("click"); $("#Context_Connect").off("click");
$("#Context_Delete_Edge").off("click"); $("#Context_Delete_Edge").off("click");
$("#Context_Edit_Edge").off("click"); $("#Context_Edit_Edge").off("click");
$("#Context_Add_Edge").off("click"); $("#Context_Add_Vertex").off("click");
$("#Context_Back_Color").off("click"); $("#Context_Back_Color").off("click");
} }
@ -462,7 +462,8 @@ BaseHandler.prototype.ShowEditEdgeDialog = function(edgeObject) {
*/ */
function DefaultHandler(app) function DefaultHandler(app)
{ {
BaseHandler.apply(this, arguments, true); this.removeStack = true;
BaseHandler.apply(this, arguments);
this.message = g_textsSelectAndMove + " <span class=\"hidden-phone\">" + g_selectGroupText + "</span>" + " <span class=\"hidden-phone\">" + g_useContextMenuText + "</span>"; this.message = g_textsSelectAndMove + " <span class=\"hidden-phone\">" + g_selectGroupText + "</span>" + " <span class=\"hidden-phone\">" + g_useContextMenuText + "</span>";
this.selectedObjects = []; this.selectedObjects = [];
this.dragObject = null; this.dragObject = null;
@ -932,7 +933,8 @@ DefaultHandler.prototype.SelectObjectInRect = function (rect)
*/ */
function AddGraphHandler(app) function AddGraphHandler(app)
{ {
BaseHandler.apply(this, arguments, true); this.removeStack = true;
BaseHandler.apply(this, arguments);
this.message = g_clickToAddVertex; this.message = g_clickToAddVertex;
this.addContextMenu(); this.addContextMenu();
} }
@ -989,7 +991,8 @@ AddGraphHandler.prototype.ChangedType = function()
*/ */
function ConnectionGraphHandler(app) function ConnectionGraphHandler(app)
{ {
BaseHandler.apply(this, arguments, true); this.removeStack = true;
BaseHandler.apply(this, arguments);
this.SelectFirst(); this.SelectFirst();
this.addContextMenu(); this.addContextMenu();
} }
@ -1094,7 +1097,8 @@ ConnectionGraphHandler.prototype.UpdateSecondVertexMenu = function(vertex2Text)
*/ */
function DeleteGraphHandler(app) function DeleteGraphHandler(app)
{ {
BaseHandler.apply(this, arguments, true); this.removeStack = true;
BaseHandler.apply(this, arguments);
this.message = g_selectObjectToDelete; this.message = g_selectObjectToDelete;
this.addContextMenu(); this.addContextMenu();
} }
@ -1470,7 +1474,7 @@ SavedDialogGraphImageHandler.prototype.showPrint = function()
*/ */
function AlgorithmGraphHandler(app, algorithm) function AlgorithmGraphHandler(app, algorithm)
{ {
BaseHandler.apply(this, arguments, true); BaseHandler.apply(this, arguments);
this.algorithm = algorithm; this.algorithm = algorithm;
this.SaveUpText(); this.SaveUpText();

View File

@ -10,7 +10,7 @@
<script src="<?= Root('i/js/dev/jquery-ui.js')?>"></script> <script src="<?= Root('i/js/dev/jquery-ui.js')?>"></script>
<script src="<?= Root('i/js/dev/jquery.feedback_me.js')?>"></script> <script src="<?= Root('i/js/dev/jquery.feedback_me.js')?>"></script>
<script src="<?= Root("script/example.js?v=59")?>" ></script> <script src="<?= Root("script/example.js?v=60")?>" ></script>
<!-- Yandex.RTB --> <!-- Yandex.RTB -->
<script>window.yaContextCb=window.yaContextCb||[]</script> <script>window.yaContextCb=window.yaContextCb||[]</script>
@ -199,7 +199,7 @@
</div> </div>
<div id="backgroundContextMenu"> <div id="backgroundContextMenu">
<div class="btn-group btn-group-vertical"> <div class="btn-group btn-group-vertical">
<button type="button" class="btn btn-default btn-sm btn-submenu" id="Context_Add_Edge"><?= L('add_node')?></button> <button type="button" class="btn btn-default btn-sm btn-submenu" id="Context_Add_Vertex"><?= L('add_node')?></button>
<button type="button" class="btn btn-default btn-sm btn-submenu" id="Context_Back_Color"><?= L('background_style') ?></button> <button type="button" class="btn btn-default btn-sm btn-submenu" id="Context_Back_Color"><?= L('background_style') ?></button>
</div> </div>
</div> </div>