Commit cac574fe authored by Romain Loth's avatar Romain Loth

better init time for graph-instance-related globals

parent 0716cc83
...@@ -1057,7 +1057,9 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -1057,7 +1057,9 @@ var TinaWebJS = function ( sigmacanvas ) {
if (TW.conf.getRelatedDocs) { if (TW.conf.getRelatedDocs) {
let ul = document.getElementById('reldocs-tabs') let ul = document.getElementById('reldocs-tabs')
let tabEls = [] // remove any previous tabs
ul.innerHTML=""
TW.gui.reldocTabs = [{},{}]
// for all existing nodetypes // for all existing nodetypes
for (let nodetypeId in initialActivetypes) { for (let nodetypeId in initialActivetypes) {
......
...@@ -2,22 +2,9 @@ ...@@ -2,22 +2,9 @@
// ======= [ main TW properties initialization ] ======== // // ======= [ main TW properties initialization ] ======== //
TW.Nodes = [];
TW.Edges = [];
TW.ByType = {} // node ids sorted by nodetype id (0, 1)
TW.Relations = {} // edges sorted by source/target type id ("00", "11")
TW.Clusters = []; // "by value" facet index built in parseCustom
TW.File = "" // remember the currently opened file TW.File = "" // remember the currently opened file
TW.partialGraph = null // will contain the sigma visible graph instance
TW.labels=[]; // fulltext search list
TW.categories = []; // possible node types and their inverted map
TW.catDict = {};
TW.lastRelDocQueries = {} // avoids resending ajax if same query twice in a row
// used iff servermenu // used iff servermenu
TW.gmenuPaths={}; // map [graphname => graphsource] for file selectors TW.gmenuPaths={}; // map [graphname => graphsource] for file selectors
TW.gmenuInfos={}; // map [graphsource => { node0/1 categories TW.gmenuInfos={}; // map [graphsource => { node0/1 categories
...@@ -346,6 +333,23 @@ function syncRemoteGraphData () { ...@@ -346,6 +333,23 @@ function syncRemoteGraphData () {
// (NB inspired by Samuel's legacy bringTheNoise() function) // (NB inspired by Samuel's legacy bringTheNoise() function)
function mainStartGraph(inFormat, inData, twInstance) { function mainStartGraph(inFormat, inData, twInstance) {
// Graph-related vars
// ------------------
// POSS: "new TWGraph()..."
TW.Nodes = [];
TW.Edges = [];
TW.ByType = {} // node ids sorted by nodetype id (0, 1)
TW.Relations = {} // edges sorted by source/target type id ("00", "11")
TW.Clusters = []; // "by value" facet index built in parseCustom
TW.partialGraph = null // will contain the sigma visible graph instance
TW.labels=[]; // fulltext search list
TW.categories = []; // possible node types and their inverted map
TW.catDict = {};
TW.lastRelDocQueries = {} // avoids resending ajax if same query twice in a row
if (! inFormat || ! inData) { if (! inFormat || ! inData) {
alert("error on data load") alert("error on data load")
} }
......
...@@ -81,18 +81,6 @@ TW.resetGraph = function() { ...@@ -81,18 +81,6 @@ TW.resetGraph = function() {
// call the sigma graph clearing // call the sigma graph clearing
TW.instance.clearSigma() TW.instance.clearSigma()
// TW.categories, TW.Nodes and TW.Edges will be reset by mainStartGraph
// reset remaining global vars
TW.labels = []
TW.Relations = {}
TW.states = [TW.initialSystemState]
TW.lastRelDocQueries = {}
// reset related docs tabs
document.getElementById("reldocs-tabs").innerHTML=""
TW.gui.reldocTabs = [{},{}]
// reset rendering gui flags // reset rendering gui flags
TW.gui.selectionActive = false TW.gui.selectionActive = false
TW.gui.handpickedcolor = false TW.gui.handpickedcolor = false
...@@ -104,6 +92,8 @@ TW.resetGraph = function() { ...@@ -104,6 +92,8 @@ TW.resetGraph = function() {
// reset other gui flags // reset other gui flags
TW.gui.checkBox=false TW.gui.checkBox=false
TW.gui.lastFilters = {} TW.gui.lastFilters = {}
// remaining global vars will be reset by new graph mainStartGraph
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment