diff --git a/core/config/main.php b/core/config/main.php index ebfcb94..c58714d 100755 --- a/core/config/main.php +++ b/core/config/main.php @@ -94,5 +94,5 @@ $g_config['vote'] = "./tmp/vote/vote.txt"; $g_config['voteTopics'] = "./tmp/vote/voteTopics.txt_"; $g_config['use_js_cache'] = true; - $g_config['engine_version'] = 107; + $g_config['engine_version'] = 108; ?> diff --git a/lang/bg/home.php b/lang/bg/home.php index 86c3f7c..6411296 100644 --- a/lang/bg/home.php +++ b/lang/bg/home.php @@ -341,4 +341,9 @@ We have added Dutch translation πŸ‡³πŸ‡±. Thank you Willie de Wit"; $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/ch/home.php b/lang/ch/home.php index 4cf4b8a..bf5d79e 100644 --- a/lang/ch/home.php +++ b/lang/ch/home.php @@ -343,4 +343,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/cs/home.php b/lang/cs/home.php index 728f722..df9851e 100644 --- a/lang/cs/home.php +++ b/lang/cs/home.php @@ -342,4 +342,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> \ No newline at end of file diff --git a/lang/de/home.php b/lang/de/home.php index 4876f94..9be993a 100644 --- a/lang/de/home.php +++ b/lang/de/home.php @@ -300,4 +300,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/el/home.php b/lang/el/home.php index 471d8bf..7ee2ebf 100644 --- a/lang/el/home.php +++ b/lang/el/home.php @@ -339,4 +339,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/en/home.php b/lang/en/home.php index 9cb3524..4413026 100755 --- a/lang/en/home.php +++ b/lang/en/home.php @@ -344,4 +344,9 @@ We have added Dutch translation πŸ‡³πŸ‡±. Thank you Willie de Wit"; $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/es/home.php b/lang/es/home.php index 4192058..fbc4c5e 100755 --- a/lang/es/home.php +++ b/lang/es/home.php @@ -343,4 +343,9 @@ Tenemos traducciones en griego πŸ‡¬πŸ‡·. diff --git a/lang/fr/home.php b/lang/fr/home.php index 3f5d440..501c9fa 100644 --- a/lang/fr/home.php +++ b/lang/fr/home.php @@ -310,4 +310,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/nl/home.php b/lang/nl/home.php index faa610d..2ae00d7 100644 --- a/lang/nl/home.php +++ b/lang/nl/home.php @@ -307,4 +307,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/pl/home.php b/lang/pl/home.php index eee2720..a244538 100644 --- a/lang/pl/home.php +++ b/lang/pl/home.php @@ -343,4 +343,9 @@ DodaliΕ›my polskie tΕ‚umaczenie, Patryk"; $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/pt/home.php b/lang/pt/home.php index 0758ec4..5af766b 100644 --- a/lang/pt/home.php +++ b/lang/pt/home.php @@ -308,4 +308,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/ru/home.php b/lang/ru/home.php index 4fa8df6..394c520 100755 --- a/lang/ru/home.php +++ b/lang/ru/home.php @@ -348,4 +348,9 @@ $g_lang['shortest_loop_is'] = "ΠšΡ€Π°Ρ‚Ρ‡Π°ΠΉΡˆΠΈΠΉ Ρ†ΠΈΠΊΠ» ΠΈΠΌΠ΅Π΅Ρ‚ Π΄Π»ΠΈΠ½Π½Ρƒ "; $g_lang['salesman_path_problem'] = "Π—Π°Π΄Π°Ρ‡Π° коммивояТёра для ΠΏΡƒΡ‚ΠΈ"; $g_lang['shortest_path_is'] = "ΠšΡ€Π°Ρ‚Ρ‡Π°ΠΉΡˆΠΈΠΉ ΠΏΡƒΡ‚ΡŒ ΠΈΠΌΠ΅Π΅Ρ‚ Π΄Π»ΠΈΠ½Π½Ρƒ "; + + $g_lang['default_style'] = "По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ"; + $g_lang['night_style'] = "Ночной"; + $g_lang['large_high_contrast_style'] = "ΠšΡ€ΡƒΠΏΠ½Ρ‹ΠΉ высоко-контрастностный"; + $g_lang['styles'] = "Π‘Ρ‚ΠΈΠ»ΠΈ"; ?> diff --git a/lang/sv/home.php b/lang/sv/home.php index fb76d88..3d8ca2c 100644 --- a/lang/sv/home.php +++ b/lang/sv/home.php @@ -304,4 +304,9 @@ $g_lang['shortest_loop_is'] = "The length of shortest possible loop is "; $g_lang['salesman_path_problem'] = "Salesman Path Problem"; $g_lang['shortest_path_is'] = "The length of shortest path is "; + + $g_lang['default_style'] = "Default"; + $g_lang['night_style'] = "Night"; + $g_lang['large_high_contrast_style'] = "Large High Contrast"; + $g_lang['styles'] = "Styles"; ?> diff --git a/lang/ua/home.php b/lang/ua/home.php index 96dd307..540c504 100644 --- a/lang/ua/home.php +++ b/lang/ua/home.php @@ -346,4 +346,9 @@ $g_lang['shortest_loop_is'] = "ΠΠ°ΠΉΠΊΠΎΡ€ΠΎΡ‚ΡˆΠΈΠΉ Ρ†ΠΈΠΊΠ» ΠΌΠ°Ρ” Π΄ΠΎΠ²ΠΆΠΈΠ½Ρƒ "; $g_lang['salesman_path_problem'] = "Π—Π°Π΄Π°Ρ‡Π° комівояТСра для ΡˆΠ»ΡΡ…Ρƒ"; $g_lang['shortest_path_is'] = "ΠΠ°ΠΉΠΊΠΎΡ€ΠΎΡ‚ΡˆΠΈΠΉ ΡˆΠ»ΡΡ… ΠΌΠ°Ρ” Π΄ΠΎΠ²ΠΆΠΈΠ½Ρƒ "; + + $g_lang['default_style'] = "По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ"; + $g_lang['night_style'] = "Ночной"; + $g_lang['large_high_contrast_style'] = "ΠšΡ€ΡƒΠΏΠ½Ρ‹ΠΉ высоко-контрастностный"; + $g_lang['styles'] = "Π‘Ρ‚ΠΈΠ»ΠΈ"; ?> diff --git a/script/entities/graph/model/Graph.js b/script/entities/graph/model/Graph.js index 9a5db2f..bd24de2 100644 --- a/script/entities/graph/model/Graph.js +++ b/script/entities/graph/model/Graph.js @@ -1317,29 +1317,42 @@ Graph.prototype.checkMutiGraph = function () { var res = false; - var start = {}; + let start = {}; + + let check_pair = function(id1, id2, start) + { + return (start.hasOwnProperty(id1) && start[id1].includes(id2)); + } + + let add_to_start = function(id1, id2, start) + { + if (!start.hasOwnProperty(id1)) + { + start[id1] = []; + } + start[id1].push(id2); + } for (var i = 0; i < this.edges.length; i++) { var edge = this.edges[i]; - if (start.hasOwnProperty(edge.vertex1.id) && - start[edge.vertex1.id] == edge.vertex2.id) + if (check_pair(edge.vertex1.id, edge.vertex2.id, start)) { res = true; break; } - - start[edge.vertex1.id] = edge.vertex2.id; + + add_to_start(edge.vertex1.id, edge.vertex2.id, start); + if (!edge.isDirect) { - if (start.hasOwnProperty(edge.vertex2.id) && - start[edge.vertex2.id] == edge.vertex1.id) + if (check_pair(edge.vertex2.id, edge.vertex1.id, start)) { res = true; break; } - start[edge.vertex2.id] = edge.vertex1.id; + add_to_start(edge.vertex2.id, edge.vertex1.id, start); } } diff --git a/script/features/draw_graph/api/index.js b/script/features/draw_graph/api/index.js index 30c30af..7b9d3bd 100644 --- a/script/features/draw_graph/api/index.js +++ b/script/features/draw_graph/api/index.js @@ -14,6 +14,10 @@ doInclude ([ include ("model/PrintEdgeStyle.js", modulDir), include ("model/VertexNewWhiteStyle.js", modulDir), include ("model/EdgeNewWhiteStyle.js", modulDir), + include ("model/EdgeNewNightStyle.js", modulDir), + include ("model/VertexNewNightStyle.js", modulDir), + include ("model/EdgeContrastStyle.js", modulDir), + include ("model/VertexContrastStyle.js", modulDir), include ("model/BaseVertexDrawer.js", modulDir), include ("model/GraphFullStyle.js", modulDir) ]) diff --git a/script/features/draw_graph/model/BackgroundStyle.js b/script/features/draw_graph/model/BackgroundStyle.js index 73fc62b..9400f5d 100644 --- a/script/features/draw_graph/model/BackgroundStyle.js +++ b/script/features/draw_graph/model/BackgroundStyle.js @@ -25,11 +25,27 @@ function PrintBackgroundStyle() PrintBackgroundStyle.prototype = Object.create(CommonBackgroundStyle.prototype); +function NightBackgroundStyle() +{ + CommonBackgroundStyle.apply(this, arguments); + + this.commonColor = '#0f172a'; + this.commonOpacity = 1.0; + this.image = null; +} + +NightBackgroundStyle.prototype = Object.create(CommonBackgroundStyle.prototype); + function GetWhiteBackgroundStyle() { return new CommonBackgroundStyle(); } +function GetNightBackgroundStyle() +{ + return new NightBackgroundStyle(); +} + function DefaultCommonBackgroundStyle() { return GetWhiteBackgroundStyle(); diff --git a/script/features/draw_graph/model/EdgeContrastStyle.js b/script/features/draw_graph/model/EdgeContrastStyle.js new file mode 100644 index 0000000..b34d320 --- /dev/null +++ b/script/features/draw_graph/model/EdgeContrastStyle.js @@ -0,0 +1,43 @@ +/** + * New Contrast edge styles. + */ + + function ContrastCommonEdgeStyle() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#000000'; + this.weightText = '#000000'; + this.fillStyle = '#ffffff'; + this.textPadding = 4; + this.textStrokeWidth = 2; + this.lineDash = 0; + this.additionalTextColor = '#000000'; + this.weightPosition = WeightTextCenter; + this.mainTextFontSize = 16; +} + +ContrastCommonEdgeStyle.prototype = Object.create(BaseEdgeStyle.prototype); + +function ContrastSelectedEdgeStyle0() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#000000'; + this.weightText = '#000000'; + this.fillStyle = '#ffffff'; + this.additionalTextColor = '#000000'; + this.lineDash = 1 + + this.baseStyles.push("common"); +} + +ContrastSelectedEdgeStyle0.prototype = Object.create(BaseEdgeStyle.prototype); + +function GetContrastCommonEdgeStyle() +{ + return new ContrastCommonEdgeStyle(); +} + +var ContrastSelectedEdgeStyles = [new ContrastSelectedEdgeStyle0(), new ContrastSelectedEdgeStyle0(), + new ContrastSelectedEdgeStyle0(), new ContrastSelectedEdgeStyle0(), new ContrastSelectedEdgeStyle0()]; \ No newline at end of file diff --git a/script/features/draw_graph/model/EdgeNewNightStyle.js b/script/features/draw_graph/model/EdgeNewNightStyle.js new file mode 100644 index 0000000..d2838c2 --- /dev/null +++ b/script/features/draw_graph/model/EdgeNewNightStyle.js @@ -0,0 +1,95 @@ +/** + * New night edge styles. + */ + + +function NightCommonEdgeStyle() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#cbd5e1'; + this.weightText = '#f8fafc'; + this.fillStyle = '#020617'; + this.textPadding = 4; + this.textStrokeWidth = 2; + this.lineDash = 0; + this.additionalTextColor = '#cbd5e1'; + this.weightPosition = WeightTextCenter; +} + +NightCommonEdgeStyle.prototype = Object.create(BaseEdgeStyle.prototype); + +function NightSelectedEdgeStyle0() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#fdba74'; + this.weightText = '#fff7ed'; + this.fillStyle = '#7c2d12'; + this.additionalTextColor = '#fff7ed'; + + this.baseStyles.push("common"); +} + +NightSelectedEdgeStyle0.prototype = Object.create(BaseEdgeStyle.prototype); + +function NightSelectedEdgeStyle1() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#34d399'; + this.weightText = '#ecfdf5'; + this.fillStyle = '#064e3b'; + this.additionalTextColor = '#ecfdf5'; + + this.baseStyles.push("selected"); +} +NightSelectedEdgeStyle1.prototype = Object.create(BaseEdgeStyle.prototype); + +function NightSelectedEdgeStyle2() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#a5b4fc'; + this.weightText = '#ecfeff'; + this.fillStyle = '#312e81'; + this.additionalTextColor = '#ecfeff'; + + this.baseStyles.push("selected"); +} +NightSelectedEdgeStyle2.prototype = Object.create(BaseEdgeStyle.prototype); + + +function NightSelectedEdgeStyle3() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#fca5a5'; + this.weightText = '#fef2f2'; + this.fillStyle = '#7f1d1d'; + this.additionalTextColor = '#fef2f2'; + + this.baseStyles.push("selected"); +} +NightSelectedEdgeStyle3.prototype = Object.create(BaseEdgeStyle.prototype); + +function NightSelectedEdgeStyle4() +{ + BaseEdgeStyle.apply(this, arguments); + + this.strokeStyle = '#d4d4d8'; + this.weightText = '#fafafa'; + this.fillStyle = '#3f3f46'; + this.additionalTextColor = '#fafafa'; + + this.baseStyles.push("selected"); +} +NightSelectedEdgeStyle4.prototype = Object.create(BaseEdgeStyle.prototype); + +function GetNightCommonEdgeStyle() +{ + return new NightCommonEdgeStyle(); +} + +var NightSelectedEdgeStyles = [new NightSelectedEdgeStyle0(), new NightSelectedEdgeStyle1(), + new NightSelectedEdgeStyle2(), new NightSelectedEdgeStyle3(), new NightSelectedEdgeStyle4()]; diff --git a/script/features/draw_graph/model/GraphFullStyle.js b/script/features/draw_graph/model/GraphFullStyle.js index b841552..0e59fb4 100644 --- a/script/features/draw_graph/model/GraphFullStyle.js +++ b/script/features/draw_graph/model/GraphFullStyle.js @@ -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); \ No newline at end of file +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); \ No newline at end of file diff --git a/script/features/draw_graph/model/VertexContrastStyle.js b/script/features/draw_graph/model/VertexContrastStyle.js new file mode 100644 index 0000000..0ba9277 --- /dev/null +++ b/script/features/draw_graph/model/VertexContrastStyle.js @@ -0,0 +1,47 @@ +/** + * Contrast vertex style. + */ + +// Common style of Graphs. +function ContrastCommonVertexStyle() +{ + BaseVertexStyle.apply(this, arguments); + + this.lineWidth = 4; + this.strokeStyle = '#000000'; + this.fillStyle = '#ffffff'; + this.mainTextColor = '#000000'; + this.shape = VertexCircleShape; + this.upTextColor = '#000000'; + this.commonTextPosition = CommonTextCenter; + this.mainTextFontSize = 16; + + this.baseStyles = []; +} + +ContrastCommonVertexStyle.prototype = Object.create(BaseVertexStyle.prototype); + +// Selected style of Graphs. + +function ContrastSelectedVertexStyle0() +{ + BaseVertexStyle.apply(this, arguments); + + this.strokeStyle = '#000000'; + this.mainTextColor = '#ffffff'; + this.fillStyle = '#000000'; + this.upTextColor = '#ffffff'; + + this.baseStyles.push("common"); +} + +ContrastSelectedVertexStyle0.prototype = Object.create(BaseVertexStyle.prototype); + +function GetContrastCommonVertexStyle() +{ + return new ContrastCommonVertexStyle(); +} + +var ContrastSelectedGraphStyles = [new ContrastSelectedVertexStyle0(), new ContrastSelectedVertexStyle0(), + new ContrastSelectedVertexStyle0(), new ContrastSelectedVertexStyle0(), new ContrastSelectedVertexStyle0()]; + diff --git a/script/features/draw_graph/model/VertexNewNightStyle.js b/script/features/draw_graph/model/VertexNewNightStyle.js new file mode 100644 index 0000000..394dee3 --- /dev/null +++ b/script/features/draw_graph/model/VertexNewNightStyle.js @@ -0,0 +1,103 @@ +/** + * Night vertex style. + */ + + +// Common style of Graphs. +function NightCommonVertexStyle() +{ + BaseVertexStyle.apply(this, arguments); + + this.lineWidth = 2; + this.strokeStyle = '#38bdf8'; + this.fillStyle = '#334155'; + this.mainTextColor = '#e5e7eb'; + this.shape = VertexCircleShape; + this.upTextColor = '#94a3b8'; + this.commonTextPosition = CommonTextCenter; + + this.baseStyles = []; +} + +NightCommonVertexStyle.prototype = Object.create(BaseVertexStyle.prototype); + +// Selected style of Graphs. + +function NightSelectedVertexStyle0() +{ + BaseVertexStyle.apply(this, arguments); + + this.strokeStyle = '#fdba74'; + this.mainTextColor = '#fff7ed'; + this.fillStyle = '#7c2d12'; + this.upTextColor = '#fff7ed'; + + this.baseStyles.push("common"); +} + +NightSelectedVertexStyle0.prototype = Object.create(BaseVertexStyle.prototype); + +function NightSelectedVertexStyle1() +{ + BaseVertexStyle.apply(this, arguments); + + this.strokeStyle = '#34d399'; + this.mainTextColor = '#ecfdf5'; + this.fillStyle = '#064e3b'; + this.upTextColor = '#ecfdf5'; + + this.baseStyles.push("selected"); +} + +NightSelectedVertexStyle1.prototype = Object.create(BaseVertexStyle.prototype); + +function NightSelectedVertexStyle2() +{ + BaseVertexStyle.apply(this, arguments); + + this.strokeStyle = '#a5b4fc'; + this.mainTextColor = '#ffffff'; + this.fillStyle = '#312e81'; + this.upTextColor = '#ffffff'; + + this.baseStyles.push("selected"); +} + +NightSelectedVertexStyle2.prototype = Object.create(BaseVertexStyle.prototype); + +function NightSelectedVertexStyle3() +{ + BaseVertexStyle.apply(this, arguments); + + this.strokeStyle = '#fca5a5'; + this.mainTextColor = '#fef2f2'; + this.fillStyle = '#7f1d1d'; + this.upTextColor = '#fef2f2'; + + this.baseStyles.push("selected"); +} + +NightSelectedVertexStyle3.prototype = Object.create(BaseVertexStyle.prototype); + +function NightSelectedVertexStyle4() +{ + BaseVertexStyle.apply(this, arguments); + + this.strokeStyle = '#d4d4d8'; + this.mainTextColor = '#fafafa'; + this.fillStyle = '#3f3f46'; + this.upTextColor = '#fafafa'; + + this.baseStyles.push("selected"); +} + +NightSelectedVertexStyle4.prototype = Object.create(BaseVertexStyle.prototype); + +function GetNightCommonVertexStyle() +{ + return new NightCommonVertexStyle(); +} + +var NightSelectedGraphStyles = [new NightSelectedVertexStyle0(), new NightSelectedVertexStyle1(), + new NightSelectedVertexStyle2(), new NightSelectedVertexStyle3(), new NightSelectedVertexStyle4()]; + diff --git a/script/pages/create_graph_by_edge_list/api/index.js.cache b/script/pages/create_graph_by_edge_list/api/index.js.cache index 3f9e772..4937c28 100644 --- a/script/pages/create_graph_by_edge_list/api/index.js.cache +++ b/script/pages/create_graph_by_edge_list/api/index.js.cache @@ -1,4 +1,4 @@ -moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=107","/script/shared/point.js?v=107","/script/entities/edge/api/index.js?v=107","/script/entities/edge/model/BaseEdge.js?v=107","/script/entities/edge/model/EdgeModel.js?v=107","/script/entities/vertex/api/index.js?v=107","/script/entities/vertex/model/BaseVertex.js?v=107","/script/entities/vertex/model/VertexModel.js?v=107","/script/entities/graph/model/Graph.js?v=107",]);{let modulDir="pages/create_graph_by_edge_list/";doInclude([include("entities/graph/api/index.js")]);} +moduleLoader.beginCacheLoading(["/script/entities/graph/api/index.js?v=108","/script/shared/point.js?v=108","/script/entities/edge/api/index.js?v=108","/script/entities/edge/model/BaseEdge.js?v=108","/script/entities/edge/model/EdgeModel.js?v=108","/script/entities/vertex/api/index.js?v=108","/script/entities/vertex/model/BaseVertex.js?v=108","/script/entities/vertex/model/VertexModel.js?v=108","/script/entities/graph/model/Graph.js?v=108",]);{let modulDir="pages/create_graph_by_edge_list/";doInclude([include("entities/graph/api/index.js")]);} {let modulDir="entities/graph/";doInclude([include("shared/point.js"),include("entities/edge/api/index.js"),include("entities/vertex/api/index.js"),include("model/Graph.js",modulDir)])}function Point(x,y){this.x=x||0;this.y=y||0;};Point.prototype.x=null;Point.prototype.y=null;Point.prototype.add=function(v){return new Point(this.x+v.x,this.y+v.y);};Point.prototype.addValue=function(v){return new Point(this.x+v,this.y+v);};Point.prototype.clone=function(){return new Point(this.x,this.y);};Point.prototype.degreesTo=function(v){var dx=this.x-v.x;var dy=this.y-v.y;var angle=Math.atan2(dy,dx);return angle*(180/Math.PI);};Point.prototype.distance=function(v){return Math.sqrt(this.distanceSqr(v));};Point.prototype.distanceSqr=function(v){var x=this.x-v.x;var y=this.y-v.y;return x*x+y*y;};Point.prototype.equals=function(toCompare){return this.x==toCompare.x&&this.y==toCompare.y;};Point.prototype.interpolate=function(v,f){return new Point((this.x+v.x)*f,(this.y+v.y)*f);};Point.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y);};Point.prototype.normalize=function(thickness){var l=this.length();this.x=this.x/l*thickness;this.y=this.y/l*thickness;return new Point(this.x,this.y);};Point.prototype.normalizeCopy=function(thickness){var l=this.length();return new Point(this.x/l*thickness,this.y/l*thickness);};Point.prototype.orbit=function(origin,arcWidth,arcHeight,degrees){var radians=degrees*(Math.PI/180);this.x=origin.x+arcWidth*Math.cos(radians);this.y=origin.y+arcHeight*Math.sin(radians);};Point.prototype.rotate=function(center,degrees){var radians=degrees*(Math.PI/180);offset=this.subtract(center);this.x=offset.x*Math.cos(radians)-offset.y*Math.sin(radians);this.y=offset.x*Math.sin(radians)+offset.y*Math.cos(radians);this.x=this.x+center.x;this.y=this.y+center.y;return this;};Point.prototype.offset=function(dx,dy){this.x+=dx;this.y+=dy;};Point.prototype.subtract=function(v){return new Point(this.x-v.x,this.y-v.y);};Point.prototype.subtractValue=function(value){return new Point(this.x-value,this.y-value);};Point.prototype.multiply=function(value){return new Point(this.x*value,this.y*value);};Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")";};Point.prototype.normal=function(){return new Point(-this.y,this.x);};Point.prototype.min=function(point) {return new Point(Math.min(this.x,point.x),Math.min(this.y,point.y));};Point.prototype.max=function(point) {return new Point(Math.max(this.x,point.x),Math.max(this.y,point.y));};Point.prototype.inverse=function() @@ -574,13 +574,19 @@ continue;if((curEdge.vertex1.id==edge.vertex1.id&&curEdge.vertex2.id==edge.verte {res.push(curEdge);}} return res;} Graph.prototype.checkMutiGraph=function() -{var res=false;var start={};for(var i=0;iinclude("model/plugins/"+plugin,modulDir)),onFinish);}} function getVertexToVertexArray(graph,ignoreDirection) {res={};for(var i=0;i1) @@ -1940,12 +1995,17 @@ let g_base_style_str=" \"base_style\":";let g_base_style_0_str=" \"base_style\": Application.prototype.LoadUserSettings=function(json) {let decoded_json=gDecodeFromHTML(json);if(decoded_json!=null&&decoded_json.length>("{"+g_base_style_1_str+"+ some other}").length) {if(decoded_json.indexOf(g_base_style_str)===-1||decoded_json.indexOf(g_base_style_0_str)!==-1) -{this.style=new OldGraphFullStyle(function() -{this.redrawGraph();}.bind(this));} +{this.UpdateFullStyle(OldGraphFullStyle);} else if(decoded_json.indexOf(g_base_style_1_str)!==-1) -{this.style=new GraphFullStyle(function() -{this.redrawGraph();}.bind(this));}} +{this.UpdateFullStyle(GraphFullStyle);}} this.style.Load(decoded_json);} +Application.prototype.UpdateFullStyle=function(FullStyleType) +{let newStyle=new FullStyleType(function() +{this.redrawGraph();}.bind(this));if(newStyle.defaultVertexSize!=null) +{this.SetDefaultVertexSize(newStyle.defaultVertexSize);} +if(newStyle.defaultEdgeWidth!=null) +{this.SetDefaultEdgeWidth(newStyle.defaultEdgeWidth);} +this.style=newStyle;} Application.prototype.SetVertexStyle=function(index,style) {if(index==0) {this.style.vertexCommonStyle=style;this.style.isVertexCommonStyleCustom=true;} @@ -2291,6 +2351,12 @@ userAction(self.fullscreen?"fullscreen_on":"fullscreen_off");for(var i=0;i{let datalist=document.getElementById('vertexListCanvas');const options=datalist.options;for(let i=options.length-1;i>=0;i--){options[i].remove();} self.application.graph.vertices.forEach(vertex=>{const option=document.createElement('option');option.value=vertex.mainText;datalist.appendChild(option);});});document.getElementById('CanvasSearchText').addEventListener('input',function(event){let vertex=self.application.GetVertexByName(event.target.value);if(vertex!=null) {let size=vertex.getBBox(vertex.getStyleFor(0));let point1=vertex.position.add(new Point(-size.x/2,-size.y/2));let point2=vertex.position.add(new Point(size.x/2,size.y/2));if(!self.application.IsPointFitOnViewport(point1)||!self.application.IsPointFitOnViewport(point2)) @@ -2325,6 +2391,8 @@ $(document.getElementById("algorithmCategoryBtn1").querySelector('span[name="hid Editor.prototype.init=function() {this.application.onLoad();this.initMouseActions();this.initKeyActions();this.initButtonActions();this.initVoteButton();let self=this;loadAsyncAlgorithms(function(){self.createAlgorithmMenu();});var devTools=document.getElementById('developerTools');devTools.style.left=0;resizeCanvas();this.application.onPostLoadEvent();this.initAlgorithmList();} Editor.prototype.redraw=function(){this.application.redrawGraph();} +Editor.prototype.OnRenderToEditor=function() +{$("#CanvasMessage").css('color',this.application.style.edgeCommonStyle.strokeStyle);$("#FullscreenIcon").css('color',this.application.style.edgeCommonStyle.strokeStyle);} Editor.prototype.createAlgorithmMenu=function() {let self=this;var algorithmBaseId="Algo";var algorithms=this.application.getAlgorithmNames();var index=0;for(var i=0;i { let datalist = document.getElementById('vertexListCanvas'); const options = datalist.options; @@ -661,6 +688,12 @@ Editor.prototype.redraw = function() { this.application.redrawGraph(); } +Editor.prototype.OnRenderToEditor = function() +{ + $("#CanvasMessage").css('color', this.application.style.edgeCommonStyle.strokeStyle); + $("#FullscreenIcon").css('color', this.application.style.edgeCommonStyle.strokeStyle); +} + Editor.prototype.createAlgorithmMenu = function() { let self = this; diff --git a/tpl/home.php b/tpl/home.php index 7be046a..46a9614 100755 --- a/tpl/home.php +++ b/tpl/home.php @@ -199,22 +199,39 @@