changeset 117:35ee98a5cd0c draft

add view[0].position
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 19 Mar 2013 17:13:31 +0900
parents 55ca97731a4b
children ee7ad3b84ae4
files logs/application.log public/viewer/viewer_white.html
diffstat 2 files changed, 29 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/logs/application.log	Mon Mar 18 19:38:25 2013 +0900
+++ b/logs/application.log	Tue Mar 19 17:13:31 2013 +0900
@@ -1,6 +1,6 @@
-2013-03-15 18:39:08,386 - [INFO] - from play in main 
+2013-03-19 03:15:00,052 - [INFO] - from play in main 
 Listening for HTTP on port 9000...
 
-2013-03-15 18:39:11,526 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
+2013-03-19 03:15:05,163 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
 Application started (Dev)
 
--- a/public/viewer/viewer_white.html	Mon Mar 18 19:38:25 2013 +0900
+++ b/public/viewer/viewer_white.html	Tue Mar 19 17:13:31 2013 +0900
@@ -93,8 +93,6 @@
 	var oElem = DragHandler._oElem = this;
 	if (isNaN(parseInt(oElem.style.left))) { oElem.style.left = '0px'; }
 	if (isNaN(parseInt(oElem.style.top))) { oElem.style.top = '0px'; }
-	var x = parseInt(oElem.style.left);
-	var y = parseInt(oElem.style.top);
 	e = e ? e : window.event;
 	oElem.mouseX = e.clientX;
 	oElem.mouseY = e.clientY;
@@ -107,8 +105,14 @@
 	var x = parseInt(oElem.style.left);
 	var y = parseInt(oElem.style.top);
 	e = e ? e : window.event;
-	oElem.style.left = x + (e.clientX - oElem.mouseX) + 'px';
-	oElem.style.top = y + (e.clientY - oElem.mouseY) + 'px';
+	var nextX =  x + (e.clientX - oElem.mouseX);
+	var nextY =  y + (e.clientY - oElem.mouseY);
+	oElem.style.left = nextX + 'px';
+	oElem.style.top = nextY + 'px';
+	if (oElem.position) {
+	    oElem.position.x = nextX;
+	    oElem.position.y = nextY;
+	}
 	oElem.mouseX = e.clientX;
 	oElem.mouseY = e.clientY;
 	return false;
@@ -227,7 +231,10 @@
 function createNodeDiv(node) {
     node.view = $("<div class='graphNode'/>");
     node.view.click(function(){ clickNodeDiv(node.property.id) });
-    if(!node.position) node.position = calcNewNodePosition();
+    if(!node.position) { 
+	node.position = calcNewNodePosition();
+	node.view[0].position = node.position;
+    }
     node.view.hover();
     var div = $("<div class='graphNodeContent' />")[0];
     div.innerHTML = node.property.title;
@@ -248,7 +255,7 @@
     var kindBackground = {agree:"#aaf", rejected:"#fff"};
     var kindBorder = {agree:"#66a", rejected:"#a66"};
     div.css("background", kindBackground[node.kind]||"white");
-    div.css("border-color", kindBorder[node.kind] ||"blue");
+    div.css("border-color", kindBorder[node.kind] ||"#58f");
     div.css({
 	left: node.position.x,
 	top: node.position.y
@@ -263,7 +270,7 @@
 	if(fc) {
 	    $('#graphRoot')[0].insertBefore(node.view[0], fc);
 	} else {
-	    $('#graphRoot').append(node.view);
+	    $('#graphRoot').append(node.view[0]);
 	}
     }
 }
@@ -344,6 +351,7 @@
 	} else {
 	    c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector);
 	}
+//	jsPlumb.select({source:fromNode.view[0]}).removeAllOverlays();
 	c.setLabel({label:"<span style='color:black;'>"+rel+"</span>",cssStyle:"color:black"});
 	return c;
     }
@@ -587,6 +595,11 @@
 	    id:"7",
 	    title:"context7",
  	    createdUser:"tamayose"
+	},
+	{
+	    id:"8",
+	    title:"task2",
+ 	    createdUser:"tamayose"
 	}
     ],
     edges: [
@@ -638,8 +651,14 @@
 	    to:"5",
 	    rel:"evidence",
 	    type:""
+	},
+	{
+	    id:"19",
+	    from:"8",
+	    to:"2",
+	    rel:"version",
+	    type:""
 	}
-
     ]
 };