From ef65be74b64d02afd6d37066948ba99b4e1a18ad Mon Sep 17 00:00:00 2001 From: Hard working bee Date: Sat, 27 Jan 2024 11:36:36 +0100 Subject: [PATCH] Goal node hidden until first player reaches it --- wikiweaver-web/js/graph.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wikiweaver-web/js/graph.js b/wikiweaver-web/js/graph.js index 0ea5c6d..b95384b 100644 --- a/wikiweaver-web/js/graph.js +++ b/wikiweaver-web/js/graph.js @@ -295,6 +295,11 @@ function AddNewElement(PColor, ToString, timeadded, backmove) { // Reposition the player to the new node CList.fromnode = ToString; + // If goal node has been found, show it + if (webgraph.nodes('[group = "Goal"]').degree() > 0) { + webgraph.nodes('[group = "Goal"]').show(); + } + ForceNewLayout(NewNodeOptions); } @@ -329,6 +334,8 @@ function StartGame(StartNode, GoalNode) { webgraph.nodes('[group = "Goal"]').style("width", 40); webgraph.nodes('[group = "Goal"]').style("height", 40); + webgraph.nodes('[group = "Goal"]').hide() + ForceNewLayout(); // document.getElementById("redraw-button").disabled = false;