@@ -32,14 +32,9 @@ editor.onFreeMove = function() { | |||||
}; | }; | ||||
editor.focus = function(node) { | editor.focus = function(node) { | ||||
editor.grid.position.copy(abj.node[node].position); | |||||
gui.controls.target.copy(abj.node[node].position); | |||||
gui.hideNodeMessage(); | gui.hideNodeMessage(); | ||||
editor.selection = node; | editor.selection = node; | ||||
gui.serverMessage("Selected node " + node + "."); | gui.serverMessage("Selected node " + node + "."); | ||||
node_name.innerHTML = "Node " + node; | |||||
node_data.className = "visible"; | |||||
node_vop.innerHTML = "VOP: " + abj.node[node].vop; | |||||
}; | }; | ||||
editor.addQubitAtPoint = function(point) { | editor.addQubitAtPoint = function(point) { | ||||
@@ -136,6 +131,7 @@ editor.findNodeOnRay = function(ray) { | |||||
return undefined; | return undefined; | ||||
}; | }; | ||||
editor.deleteNode = function() { | editor.deleteNode = function() { | ||||
if (editor.selection === undefined){ return; } | if (editor.selection === undefined){ return; } | ||||
abj.del_node(editor.selection); | abj.del_node(editor.selection); | ||||
@@ -47,6 +47,17 @@ graph.update = function(newState) { | |||||
edges.add(newEdge); | edges.add(newEdge); | ||||
} | } | ||||
if (editor.selection) { | |||||
var node = editor.selection; | |||||
editor.grid.position.copy(abj.node[node].position); | |||||
gui.controls.target.copy(abj.node[node].position); | |||||
node_name.innerHTML = "Node " + node; | |||||
node_data.className = "visible"; | |||||
node_vop.innerHTML = "VOP: " + abj.node[node].vop; | |||||
} else { | |||||
node_data.className = "hidden"; | |||||
} | |||||
var particles = new THREE.Points(geometry, materials.qubit); | var particles = new THREE.Points(geometry, materials.qubit); | ||||
var object = new THREE.Object3D(); | var object = new THREE.Object3D(); | ||||
object.name = "graphstate"; | object.name = "graphstate"; | ||||
@@ -54,5 +65,6 @@ graph.update = function(newState) { | |||||
object.add(edges); | object.add(edges); | ||||
gui.scene.add(object); | gui.scene.add(object); | ||||
gui.render(); | gui.render(); | ||||
}; | }; | ||||
@@ -25,11 +25,14 @@ def process_edit(edit, server): | |||||
print local_state.node.keys() | print local_state.node.keys() | ||||
if action == "create": | |||||
print type(edit["name"]) | |||||
local_state.add_qubit(edit["name"], position=edit["position"], vop=0) | |||||
if action == "cz": | |||||
local_state.act_cz(edit["start"], edit["end"]) | |||||
try: | |||||
if action == "create": | |||||
print type(edit["name"]) | |||||
local_state.add_qubit(edit["name"], position=edit["position"], vop=0) | |||||
if action == "cz": | |||||
local_state.act_cz(edit["start"], edit["end"]) | |||||
except Exception as e: | |||||
print e | |||||
server.send_message_to_all(json.dumps(local_state.to_json())) | server.send_message_to_all(json.dumps(local_state.to_json())) | ||||