# HG changeset patch # User Nobuyasu Oshiro # Date 1363526371 -32400 # Node ID bf0b1f71ac818d398254ff97d8304ab40e678eff # Parent 42799d9c375384f653cce9c6bfe9f839800870a0 modified graph -> node diff -r 42799d9c3753 -r bf0b1f71ac81 public/viewer/viewer_white.html --- a/public/viewer/viewer_white.html Sun Mar 17 19:53:59 2013 +0900 +++ b/public/viewer/viewer_white.html Sun Mar 17 22:19:31 2013 +0900 @@ -121,8 +121,8 @@ $(function() { userName = localStorage.userName; - if(userName) {start();} - else { } +// start(); + testStart(); }) function beginScript() { @@ -230,17 +230,23 @@ var nodeNum = 0; var OFFSET = 100; +var miniD = $('#miniDisplay')[0].style; +var offsetLeft = parseInt(miniD.width.split('px')[0]); +var offsetTop = parseInt(miniD.height.split('px')[0]); +function calcNewNodePosition() { + var position = {}; + position = {x: nodeNum*OFFSET + offsetLeft, y: nodeNum*OFFSET + offsetTop/2}; + nodeNum++; + return position; +} + function createNodeDiv(node) { node.view = $("
"); - var miniD = $('#miniDisplay')[0].style; - var offsetLeft = parseInt(miniD.width.split('px')[0]); - var offsetTop = parseInt(miniD.height.split('px')[0]); - node.position = {x:nodeNum*OFFSET + offsetLeft, y: nodeNum*OFFSET + offsetTop/2}; + node.position = calcNewNodePosition(); node.view.hover(); var div = $("
")[0]; div.innerHTML = node.property.title; node.view[0].appendChild(div); - nodeNum++; return node; } @@ -288,24 +294,6 @@ intervalY:120 }; -function start() { - init(); - var rootNode = new Object(); - rootNode.property = sampleJSON1; - showMiniDisplay(rootNode); - updateNode(rootNode); - /* test code */ - var n1 = {property:{title:"task2"}}; - var n2 = {property:{title:"task3"}}; - updateNode(n1); - updateNode(n2); - - var e1 = new Edge(rootNode, n1, "dependency"); - var e2 = new Edge(n1, n2, "dependency"); - edgeArray.push(e1); - edgeArray.push(e2); - paintEdge(); -} var edgeArray = new Array(); function Edge(fromNode, toNode, relation) { @@ -361,31 +349,80 @@ } */ var graphData = {}; - graphData.graphs = {}; + graphData.nodes = {}; graphData.edges = {}; return graphData; } function parseJSONGraphData(memory ,jsonObj) { - var graphs = jsonObj.graphs; - for (var i=0; i