Selaa lähdekoodia

Selection now works - pretty hacky though.

master
Pete Shadbolt 8 vuotta sitten
vanhempi
commit
1c80b1f394
3 muutettua tiedostoa jossa 21 lisäystä ja 10 poistoa
  1. +1
    -5
      abp/static/scripts/editor.js
  2. +12
    -0
      abp/static/scripts/graph.js
  3. +8
    -5
      bin/abpserver

+ 1
- 5
abp/static/scripts/editor.js Näytä tiedosto

@@ -32,14 +32,9 @@ editor.onFreeMove = function() {
};

editor.focus = function(node) {
editor.grid.position.copy(abj.node[node].position);
gui.controls.target.copy(abj.node[node].position);
gui.hideNodeMessage();
editor.selection = 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) {
@@ -136,6 +131,7 @@ editor.findNodeOnRay = function(ray) {
return undefined;
};


editor.deleteNode = function() {
if (editor.selection === undefined){ return; }
abj.del_node(editor.selection);


+ 12
- 0
abp/static/scripts/graph.js Näytä tiedosto

@@ -47,6 +47,17 @@ graph.update = function(newState) {
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 object = new THREE.Object3D();
object.name = "graphstate";
@@ -54,5 +65,6 @@ graph.update = function(newState) {
object.add(edges);
gui.scene.add(object);
gui.render();

};


+ 8
- 5
bin/abpserver Näytä tiedosto

@@ -25,11 +25,14 @@ def process_edit(edit, server):

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()))



Loading…
Peruuta
Tallenna