Browse Source

Increased robustness. Some DRY crimes.

master
Pete Shadbolt 7 years ago
parent
commit
209209c71d
2 changed files with 10 additions and 2 deletions
  1. +9
    -2
      abp/static/scripts/editor.js
  2. +1
    -0
      abp/static/scripts/graph.js

+ 9
- 2
abp/static/scripts/editor.js View File

@@ -34,7 +34,8 @@ editor.onFreeMove = function() {
editor.focus = function(node) {
gui.hideNodeMessage();
editor.selection = node;
gui.serverMessage("Selected node " + node + ".");

//gui.serverMessage("Selected node " + node + ".");
};

editor.addQubitAtPoint = function(point) {
@@ -52,6 +53,12 @@ editor.onClick = function() {
var found = editor.findNodeOnRay(mouse.ray);
if (found) {
editor.focus(found);
var node=found;
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 {
var intersection = mouse.ray.intersectPlane(editor.plane);
if (intersection !== null) {
@@ -67,8 +74,8 @@ editor.onShiftClick = function() {
if (found === editor.selection){ return; }
//abj.act_cz(found, editor.selection);
websocket.edit({action:"cz", start:found, end:editor.selection});
editor.focus(found);
gui.serverMessage("Acted CZ between " + found + " & " + editor.selection + ".");
editor.focus(found);
graph.update();
};



+ 1
- 0
abp/static/scripts/graph.js View File

@@ -48,6 +48,7 @@ graph.update = function(newState) {
}

if (editor.selection) {
console.log(editor.selection);
var node = editor.selection;
editor.grid.position.copy(abj.node[node].position);
gui.controls.target.copy(abj.node[node].position);


Loading…
Cancel
Save