Fix loading old graphs.

This commit is contained in:
Oleg Sh
2021-06-15 20:47:01 +02:00
parent 1b3d8d72bc
commit 320de9f399
3 changed files with 27 additions and 4 deletions

View File

@@ -43,8 +43,19 @@ const WeightTextCenter = 0,
if (this.hasOwnProperty('weightPosition'))
baseStyle.weightPosition = this.weightPosition;
return baseStyle;
}
return this.FixNewFields(baseStyle);
}
BaseEdgeStyle.prototype.FixNewFields = function (style)
{
if (!style.hasOwnProperty('lineDash'))
style.lineDash = 0;
if (!style.hasOwnProperty('weightPosition'))
style.weightPosition = WeightTextCenter;
return style;
}
BaseEdgeStyle.prototype.Clear = function ()
{

View File

@@ -112,7 +112,19 @@ BaseVertexStyle.prototype.GetStyle = function (baseStyle, object)
baseStyle.commonTextPosition = this.commonTextPosition;
baseStyle.lineWidth = parseInt(baseStyle.lineWidth);
return baseStyle;
return this.FixNewFields(baseStyle);
}
BaseVertexStyle.prototype.FixNewFields = function (style)
{
if (!style.hasOwnProperty('shape'))
style.shape = VertexCircleShape;
if (!style.hasOwnProperty('commonTextPosition'))
style.commonTextPosition = CommonTextCenter;
return style;
}
BaseVertexStyle.prototype.Clear = function ()