Fix bug with rename vertex. Add postfix for graph with styles.

This commit is contained in:
Unick Soft 2019-09-08 16:22:11 +02:00
parent 1abf19abbf
commit c580c5aef9
2 changed files with 24 additions and 17 deletions

View File

@ -937,7 +937,7 @@ Application.prototype.SaveGraphOnDisk = function ()
Application.prototype.SaveGraphImageOnDisk = function (showDialogCallback) Application.prototype.SaveGraphImageOnDisk = function (showDialogCallback)
{ {
var imageName = this.GetNewGraphName(); var imageName = this.GetNewName();
this.stopRenderTimer(); this.stopRenderTimer();
this.redrawGraph(); this.redrawGraph();
@ -978,7 +978,7 @@ Application.prototype.SaveGraphImageOnDisk = function (showDialogCallback)
Application.prototype.SaveFullGraphImageOnDisk = function (showDialogCallback, forPrint) Application.prototype.SaveFullGraphImageOnDisk = function (showDialogCallback, forPrint)
{ {
var imageName = this.GetNewGraphName(); var imageName = this.GetNewName();
this.stopRenderTimer(); this.stopRenderTimer();
var canvas = forPrint ? this._PrintRedrawGraph() : this._OffscreenRedrawGraph(); var canvas = forPrint ? this._PrintRedrawGraph() : this._OffscreenRedrawGraph();
@ -1038,6 +1038,19 @@ Application.prototype.LoadGraphFromDisk = function (graphName)
Application.prototype.GetNewGraphName = function() Application.prototype.GetNewGraphName = function()
{
var name = this.GetNewName();
if (this.isVertexCommonStyleCustom || this.isVertexSelectedVertexStylesCustom ||
this.isBackgroundCommonStyleCustom || this.isEdgeCommonStyleCustom || this.isEdgeSelectedStylesCustom)
{
name = name + "ZZcst";
}
return name;
}
Application.prototype.GetNewName = function()
{ {
var name = ""; var name = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

View File

@ -203,8 +203,6 @@ function DefaultHandler(app)
{ {
BaseHandler.apply(this, arguments); BaseHandler.apply(this, arguments);
this.message = g_textsSelectAndMove; this.message = g_textsSelectAndMove;
this.bindedRename = false;
} }
// inheritance. // inheritance.
@ -276,19 +274,15 @@ DefaultHandler.prototype.MouseUp = function(pos)
this.message = g_textsSelectAndMove + " <button type=\"button\" id=\"renameButton\" class=\"btn btn-default btn-xs\" style=\"float:right;z-index:1;position: relative;\">" + g_renameVertex + "</button>"; this.message = g_textsSelectAndMove + " <button type=\"button\" id=\"renameButton\" class=\"btn btn-default btn-xs\" style=\"float:right;z-index:1;position: relative;\">" + g_renameVertex + "</button>";
var handler = this; var handler = this;
if (!this.bindedRename) var callback = function (enumType) {
{ handler.RenameVertex(enumType.GetVertexText(0));
var callback = function (enumType) { userAction("RenameVertex");
handler.RenameVertex(enumType.GetVertexText(0)); };
userAction("RenameVertex"); $('#message').unbind();
}; $('#message').on('click', '#renameButton', function(){
$('#message').unbind(); var customEnum = new TextEnumVertexsCustom();
$('#message').on('click', '#renameButton', function(){ customEnum.ShowDialog(callback, g_rename, g_renameVertex, handler.selectedObject.mainText);
var customEnum = new TextEnumVertexsCustom(); });
customEnum.ShowDialog(callback, g_rename, g_renameVertex, handler.selectedObject.mainText);
});
this.bindedRename = true;
}
} }
else if (this.selectedObject != null && (this.selectedObject instanceof BaseEdge)) else if (this.selectedObject != null && (this.selectedObject instanceof BaseEdge))
{ {