From ea3316bea21fa3b384951eab63fdafd19d7df5bb Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 28 Jul 2014 23:55:08 +0300 Subject: Panning, bug fixes --- index.html | 2 +- scripts/rhizicore.js | 32 +++++++++----- scripts/textanalysis.js | 113 +++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 119 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index 484930aa..f63ff8c1 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - + diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index 7b0e7514..c5eee1fe 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -254,11 +254,8 @@ function myGraph(el) { .attr("pointer-events", "all") .append("g") .call(zoomObject) - .on("mousedown.zoom", null) .append("g"); - vis.on("mousedown.zoom", null); - vis.on("mousemove.zoom", null); function zoom() { if(graphstate==="GRAPH")vis.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")"); @@ -373,7 +370,7 @@ function myGraph(el) { }); var nodeEnter = node.enter() - .append("g").call(force.drag); + .append("g"); nodetext = nodeEnter.insert("text") .attr("class", "nodetext graph") @@ -565,11 +562,21 @@ function tick(e) { var k = 15 * e.alpha; + var counter=0; links.forEach(function (d, i) { - d.source.x -= k; + counter++; + + d.source.x -= k; d.target.x += k; - d.source.y -= k / 3; - d.target.y += k / 3; + if(counter%2===0){ + d.source.y -= k/3; + d.target.y += k/3; + }else{ + + d.source.y += k/3; + d.target.y -= k/3; + + } }); } @@ -626,7 +633,8 @@ function tick(e) { function deliverableTest() { var status= "unknown"; - for (var i = 0; i < 60; i++) { + var nodecounter=80; + for (var i = 0; i < nodecounter; i++) { if(Math.random()>0.7)status="done"; else if(Math.random()>0.5) status="current"; else status="waiting"; @@ -635,10 +643,10 @@ function deliverableTest() { graph.addNodeComplete("Task " + i, "deliverable", "perm", start, end, status); } - for (var i = 0; i < 60; i++) { - var endindex = Math.floor(Math.random() * i); - var startindex = Math.floor(Math.random() * i); - if(nodes[endindex].start>nodes[startindex].start){ + for (var i = 0; i < nodecounter; i++) { + var endindex = Math.floor(Math.random() * nodecounter); + var startindex = Math.floor(Math.random() * nodecounter); + if(nodes[endindex].start>nodes[startindex].start && startindex !== endindex){ graph.addLink("Task " + startindex, "Task " + endindex, "depends on", "perm"); }else{ graph.addLink("Task " + endindex, "Task " + startindex, "depends on", "perm"); diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index b5e671af..4996f80d 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -81,6 +81,89 @@ window.setInterval(function () { + + + +var sentenceStack = []; +function TextAnalyser2(newtext) { + var states = ["NOTHING", "NEWNODE", "EDITNODE", "CLOSENODE", "NEWLINK", "EDITLINK" , "SPECIAL" , "QUARTET"]; + var segment = [], subsegment = [], sentence = []; + var links=[],linkindex=0; + var nodes=[],nodeindex=0; + var orderStack = []; + var quoteword=""; + + //Sentence Sequencing + //Build the words and cuts the main elements + segment=newtext.split("#"); + for(var j=0;j2) if(!links[linkindex]){links[linkindex]=sentence[m]; }else{ links[linkindex]+=sentence[m]; } + linkindex++; + } + if(!links[linkindex]){links[linkindex]=sentence[m]+" "; }else{ links[linkindex]+=sentence[m]+" ";} + orderStack.push("DEFAULT"); + break; + } + } + + console.log(orderStack); + console.log(nodes); + console.log(links); + + linkindex=0; + nodeindex=0; + var word; + for(var m=0; m 0); break; - case "CLOSENODE": + case "CLOSENODE": do { newnode = newtext.charAt(index) + newnode; newnode = newnode.replace(/\s/g, ''); index--; } while (newtext.charAt(index) !== "#" && index > 0); break; - case "NEWLINK": + case "NEWLINK": newlink = ""; break; - case "EDITLINK": + case "EDITLINK": newnode = ""; break; } @@ -169,12 +252,12 @@ function TextAnalyser(newtext) { switch (order) { - case states[0]: + case states[0]: window.setTimeout(function () { $('#textanalyser').css('box-shadow', '0 0 0px #303030') }, 200); break; - case states[1]: + case states[1]: if (nodecounter % 2 === 0) { @@ -185,7 +268,7 @@ function TextAnalyser(newtext) { graph.editType("x", "temp", nodetypes[typeindex]); nodecounter++; break; - case states[2]: + case states[2]: if (nodereplaced === true) { //graph.removeLink(); //graph.addLink @@ -206,7 +289,7 @@ function TextAnalyser(newtext) { graph.editName("x", "temp", newnode); graph.findCoordinates("x", "temp"); break; - case states[3]: + case states[3]: nodereplaced = false; graph.editState("x", "temp", "perm"); @@ -222,11 +305,11 @@ function TextAnalyser(newtext) { newnode = ""; } break; - case states[4]: + case states[4]: graph.addNode("", "empty", "temp"); graph.addLink(addednodes[nodecounter - 1], "", newlink, "perm"); break; - case states[5]: + case states[5]: graph.editLink(addednodes[nodecounter - 1], "", newlink); break; } -- cgit v1.3.1