aboutsummaryrefslogtreecommitdiffstats
path: root/grapher/script.js
diff options
context:
space:
mode:
authoralyx <alyx@aleteoryx.me>2022-02-04 21:26:20 +0000
committerAleteoryx <alyx@aleteoryx.me>2022-02-04 21:26:20 +0000
commit1b43c68210da0e45dce23f37cc2cad9717ca4d75 (patch)
tree93568f972414dd8a199b32d430e8a1dd713a21c8 /grapher/script.js
parentfabe19e3d993fc57cbc1102f55cdfa26ab3009c7 (diff)
downloadRRCUtils-1b43c68210da0e45dce23f37cc2cad9717ca4d75.tar.gz
RRCUtils-1b43c68210da0e45dce23f37cc2cad9717ca4d75.tar.bz2
RRCUtils-1b43c68210da0e45dce23f37cc2cad9717ca4d75.zip
chips now place at the center of the screen.
Diffstat (limited to 'grapher/script.js')
-rw-r--r--grapher/script.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/grapher/script.js b/grapher/script.js
index 807a88d..9b0be9f 100644
--- a/grapher/script.js
+++ b/grapher/script.js
@@ -120,12 +120,20 @@ window.onload = async function() {
chipcontainer.append(generateChipHTML(v2data.Nodes[data.GUID].NodeDescs));
ne.append(chipcontainer);
graph.append(ne);
+
+ let newchipx = -graphPos.x + (graph.getClientRects()[0].width / 2) - (ne.getClientRects()[0].width / 2);
+ let newchipy = -graphPos.y + (graph.getClientRects()[0].height / 2) - (ne.getClientRects()[0].height / 2);
+ ne.style.setProperty('--chipOffsetX', newchipx);
+ ne.style.setProperty('--chipOffsetY', newchipy);
+
+
const chip = {
el: ne,
typeInfo: types,
currentOverrides: [],
nd: v2data.Nodes[data.GUID].NodeDescs
};
+
appendTypeUI(chip);
chips.push(chip);
console.log(types);
@@ -133,7 +141,7 @@ window.onload = async function() {
}
graph.addEventListener('mousedown', function(e) {
- if (e.button == 0) {
+ if (e.buttons & 1) {
start = performance.now();
targ = e.target;
if (e.target.parentElement.matches('.input')) {
@@ -198,6 +206,11 @@ window.onload = async function() {
});
rootel.addEventListener("mousemove", e => {
+ if (e.buttons & 2) {
+ mode = '';
+ let tmp = connections.pop();
+ if ((tmp.i instanceof Element) && (tmp.o instanceof Element)) connections.push(tmp);
+ }
if (e.buttons & 4) {
graphPos.x += e.clientX - lastmp.x;
graphPos.y += e.clientY - lastmp.y;