Compare commits
3
Commits
v0.3.4
..
47d7f9d2c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47d7f9d2c3 | ||
|
|
12e9fcd609 | ||
|
|
72674afe05 |
Generated
+1
-1
@@ -2948,7 +2948,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "portal"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "portal"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
||||
+12
-8
@@ -12,8 +12,10 @@
|
||||
//
|
||||
// When a relay URL is given, the widget also speaks the redoal-relay
|
||||
// protocol (ADR-0013 in the redoal repo): announce the stroke, receive
|
||||
// an ack carrying the stroke's gesture key + the key's own decoded
|
||||
// path ("what the network heard", drawn as a ghost), and receive
|
||||
// an ack carrying the stroke's gesture key plus the key's own decoded
|
||||
// path - "what the network heard", drawn as a ghost under the stroke
|
||||
// when the key is v2 or later (ADR-0014's ordered turning chain; a v1
|
||||
// key's histogram decode is a blob and stays hidden) - and receive
|
||||
// echoes of similar strokes other visitors drew, shown as thumbnails.
|
||||
// Everything network is best-effort: no relay, refused connection, or
|
||||
// a dropped socket all degrade to a plain offline drawing input.
|
||||
@@ -26,13 +28,13 @@
|
||||
const THEMES = {
|
||||
dark: {
|
||||
stroke: '#8ec2c0',
|
||||
ghost: 'rgba(255, 255, 255, 0.28)',
|
||||
echo: '#8ec2c0',
|
||||
ghost: 'rgba(255, 255, 255, 0.28)',
|
||||
},
|
||||
light: {
|
||||
stroke: '#47807e',
|
||||
ghost: 'rgba(29, 29, 27, 0.30)',
|
||||
echo: '#47807e',
|
||||
ghost: 'rgba(29, 29, 27, 0.30)',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -46,8 +48,8 @@ class GestureWidget {
|
||||
this.container = container;
|
||||
this.hidden = hidden || null;
|
||||
this.relayUrl = relayUrl || '';
|
||||
this.points = [];
|
||||
this.ghost = null;
|
||||
this.points = [];
|
||||
this.drawing = false;
|
||||
this.stopped = false;
|
||||
this.ws = null;
|
||||
@@ -111,10 +113,10 @@ class GestureWidget {
|
||||
e.preventDefault();
|
||||
this.canvas.setPointerCapture(e.pointerId);
|
||||
// One stroke only - a new pointerdown replaces the old drawing
|
||||
// (and any ghost/ambient trails from the previous round).
|
||||
// (and any ghost from the previous round).
|
||||
this.drawing = true;
|
||||
this.points = [this.pos(e)];
|
||||
this.ghost = null;
|
||||
this.points = [this.pos(e)];
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -215,7 +217,9 @@ class GestureWidget {
|
||||
if (this.points.length >= 2) {
|
||||
this.setValue({ points: this.normalized(), key: msg.key });
|
||||
}
|
||||
this.ghost = msg.path;
|
||||
// Version nibble is the key's first hex digit.
|
||||
const version = parseInt((msg.key || '0')[0], 16);
|
||||
this.ghost = version >= 2 && Array.isArray(msg.path) ? msg.path : null;
|
||||
this.render();
|
||||
} else if (msg.type === 'echo') {
|
||||
this.addEchoThumbnail(msg);
|
||||
|
||||
Reference in New Issue
Block a user