@@ -48,18 +48,7 @@ editor.addQubitAtPoint = function(point) { | |||||
} | } | ||||
point.round(); | point.round(); | ||||
// Check for clashes | |||||
for (var node in abj.node) { | |||||
var delta = new THREE.Vector3(); | |||||
delta.subVectors(abj.node[node].position, point); | |||||
if (delta.length()<0.1){ return; } | |||||
} | |||||
// TODO: This SUCKS | |||||
var new_node = point.x + "." + point.y + "." + point.z; | |||||
abj.add_node(new_node, { position: point, vop:0 }); | |||||
editor.focus(new_node); | |||||
graph.update(); | |||||
websocket.edit({test:"test"}); | |||||
gui.serverMessage("Created node " + new_node +"."); | gui.serverMessage("Created node " + new_node +"."); | ||||
}; | }; | ||||
@@ -26,3 +26,7 @@ websocket.connect = function(update) { | |||||
gui.serverMessage("No connection to server. <a href='#' onclick='javascript:websocket.connect()'>Reconnect</a>.", true); | gui.serverMessage("No connection to server. <a href='#' onclick='javascript:websocket.connect()'>Reconnect</a>.", true); | ||||
}; | }; | ||||
}; | }; | ||||
websocket.edit = function (data) { | |||||
websocket.ws.send("edit:"+JSON.stringify(data)); | |||||
}; |
@@ -18,7 +18,8 @@ from pkg_resources import resource_filename | |||||
clients = [] | clients = [] | ||||
def new_message(client, server, message): | def new_message(client, server, message): | ||||
if message.startswith("edit"): | |||||
if message.startswith("edit:"): | |||||
print message[5:] | |||||
edit = json.loads(message[5:]) | edit = json.loads(message[5:]) | ||||
print "Received update from javascript." | print "Received update from javascript." | ||||
print edit | print edit | ||||