From 7f6f5549fe6d1bd03772c13e96f9d92a26660929 Mon Sep 17 00:00:00 2001
From: alyx
Date: Mon, 6 Jun 2022 18:16:16 +0000
Subject: goofy bits of gass and such, more typing
---
grapher/script.js | 37 +++++++++++++++++----
images/grapher.png | Bin 0 -> 63804 bytes
images/searcher.png | Bin 0 -> 17803 bytes
index.html | 50 +++++++++++++++++++++++-----
lib/chips.css | 2 +-
lib/types.js | 90 +++++++++++++++++++++++++++++++++++++++++++++++---
pwathings/appver.json | 2 +-
style.css | 63 +++++++++++++++++++++++++++++++++++
8 files changed, 222 insertions(+), 22 deletions(-)
create mode 100644 images/grapher.png
create mode 100644 images/searcher.png
diff --git a/grapher/script.js b/grapher/script.js
index 4df4516..70be078 100644
--- a/grapher/script.js
+++ b/grapher/script.js
@@ -56,6 +56,7 @@ var mode;
var targ;
var start;
var wirestate;
+var maintouch;
const lastmp = {x:0,y:0};
const graphPos = {x:0,y:0};
@@ -315,9 +316,7 @@ window.onload = async function() {
}
- graph.addEventListener('mousedown', function(e) {
- if ((e.buttons & 1) && !locked) {
- start = performance.now();
+ function clickToWire(e) {start = performance.now();
targ = e.target;
if (e.target.parentElement.matches('.input')) {
if (!e.target.matches('.exec')) delConnections(e.target);
@@ -349,11 +348,21 @@ window.onload = async function() {
else if (e.target == graph) switchID(null, 'selected')
clean = false
+ }
+
+ graph.addEventListener('mousedown', function(e) {
+ if ((e.buttons & 1) && !locked) {
+ clickToWire(e);
+ }
+ });
+ graph.addEventListener('touchstart', function(e) {
+ if (e.touches.length <= 1) {
+ maintouch = e.changedTouches[0];
+ clickToWire(e);
}
});
- rootel.addEventListener("mouseup", e => {
- if ((e.button == 0) && !locked) {
+ function unclickToWire(e) {
let newCon;
switch (mode) {
case 'wire_i-o':
@@ -371,13 +380,23 @@ window.onload = async function() {
connections.push(newCon);
break;
case 'drag':
- if ((performance.now() - start) < 150 && !targ.querySelector('.selUI').matches('#selected')) {
+ if ((performance.now() - start) < 300 && !targ.querySelector('.selUI').matches('#selected')) {
switchID(targ.children[0], 'selected')
}
break;
}
mode = null;
- clean = false
+ clean = false;
+ }
+ rootel.addEventListener("mouseup", e => {
+ if ((e.button == 0) && !locked) {
+ unclickToWire(e);
+ }
+ });
+ graph.addEventListener('touchend', e => {
+ if (e.changedTouches[0] == maintouch) {
+ maintouch = null;
+ unclickToWire(e);
}
});
@@ -409,6 +428,10 @@ window.onload = async function() {
if (mode)
clean = false
});
+ rootel.addEventListener('touchdrag', e => {
+ lastmp.x = e.changedTouches[0].clientX;
+ lastmp.y = e.changedTouches[0].clientY;
+ })
root.addEventListener("mousemove", e => {
diff --git a/images/grapher.png b/images/grapher.png
new file mode 100644
index 0000000..83b9d1a
Binary files /dev/null and b/images/grapher.png differ
diff --git a/images/searcher.png b/images/searcher.png
new file mode 100644
index 0000000..adee09b
Binary files /dev/null and b/images/searcher.png differ
diff --git a/index.html b/index.html
index db3d610..5b0d7a3 100644
--- a/index.html
+++ b/index.html
@@ -26,12 +26,46 @@
Below you'll find a collection of tools for understanding and explaining R2C, as well as playing with it out-of-game.
This site is in a perpetual state of work-in-progress, but there's a changelog below, too.
-
+
+
+
+ June 6, 2022 - Just the same as you and me!
+
+
+ - Created a nicer display for the links, with neat frosted glass effeects.
+
+
+
+ June 3, 2022 - The Three Clicks Edition
+
+
+ - Continued work on type inference logic.
+
+ - There is now something that can parse in R2C types,
+ as well as plenty of methods for computing intersections between them.
+ - As Always:
+
+ - You can view it at types.html, by opening the DevTools console.
+ - The actual logic is contained in
/lib/types.js
.
+
+
+ - The links at the bottom of the homepage now use funny icons for the ::marker bit!
+
+
June 2, 2022 - The Three Clicks Edition
@@ -61,9 +95,9 @@
Credits:
Though I've tried to keep as much of this codebase my own as possible,
R2CUtils depends on the following projects:
-