Implement style switching functionality. Add default, night, and high contrast styles.

This commit is contained in:
Oleg Sh
2026-01-12 19:05:49 +01:00
parent dee5d4c4ea
commit 6f5fb0fc9c
30 changed files with 661 additions and 63 deletions

View File

@@ -18,8 +18,8 @@ function GraphFullStyle(redrawCallback)
this.backgroundCommonStyle = DefaultCommonBackgroundStyle();
this.isBackgroundCommonStyleCustom = false;
this.defaultVertexSize = null;
this.defaultEdgeWidth = null;
this.defaultVertexSize = 30;
this.defaultEdgeWidth = 3;
this.redrawCallback = redrawCallback;
}
@@ -238,6 +238,63 @@ function OldGraphFullStyle()
this.vertexSelectedVertexStyles = FullArrayCopy(OldSelectedGraphStyles);
this.backgroundCommonStyle = GetWhiteBackgroundStyle();
this.defaultVertexSize = 30;
this.defaultEdgeWidth = 4;
}
OldGraphFullStyle.prototype = Object.create(GraphFullStyle.prototype);
OldGraphFullStyle.prototype = Object.create(GraphFullStyle.prototype);
function NightGraphFullStyle()
{
GraphFullStyle.apply(this, arguments);
this.version = 1;
this.edgeCommonStyle = GetNightCommonEdgeStyle();
this.edgeSelectedStyles = FullArrayCopy(NightSelectedEdgeStyles);
this.vertexCommonStyle = GetNightCommonVertexStyle();
this.vertexSelectedVertexStyles = FullArrayCopy(NightSelectedGraphStyles);
this.backgroundCommonStyle = GetNightBackgroundStyle();
this.defaultVertexSize = 30;
this.defaultEdgeWidth = 3;
this.isEdgeCommonStyleCustom = true;
this.isEdgeSelectedStylesCustom = true;
this.isVertexCommonStyleCustom = true;
this.isVertexSelectedVertexStylesCustom = true;
this.isBackgroundCommonStyleCustom = true;
}
NightGraphFullStyle.prototype = Object.create(GraphFullStyle.prototype);
function ContrastGraphFullStyle()
{
GraphFullStyle.apply(this, arguments);
this.version = 1;
this.edgeCommonStyle = GetContrastCommonEdgeStyle();
this.edgeSelectedStyles = FullArrayCopy(ContrastSelectedEdgeStyles);
this.vertexCommonStyle = GetContrastCommonVertexStyle();
this.vertexSelectedVertexStyles = FullArrayCopy(ContrastSelectedGraphStyles);
this.backgroundCommonStyle = GetWhiteBackgroundStyle();
this.defaultVertexSize = 36;
this.defaultEdgeWidth = 4;
this.isEdgeCommonStyleCustom = true;
this.isEdgeSelectedStylesCustom = true;
this.isVertexCommonStyleCustom = true;
this.isVertexSelectedVertexStylesCustom = true;
this.isBackgroundCommonStyleCustom = true;
}
ContrastGraphFullStyle.prototype = Object.create(GraphFullStyle.prototype);