summaryrefslogtreecommitdiff
path: root/index.htm
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-01-07 00:16:22 +0100
committerMitya Selivanov <automainint@guattari.tech>2025-01-07 00:16:22 +0100
commit91646cbafee3ff67baff52499529ac9077675239 (patch)
treeef450666dc81f014025425264cf38b2bac2ab7c3 /index.htm
parent8572d0ade4d8447ba68c4f6e3a7e791a8b38ad22 (diff)
downloadreduced_system_layer-web_audio.zip
Fix clipboard; TODO keysweb_audio
Diffstat (limited to 'index.htm')
-rw-r--r--index.htm15
1 files changed, 10 insertions, 5 deletions
diff --git a/index.htm b/index.htm
index 7f82840..33d6c2d 100644
--- a/index.htm
+++ b/index.htm
@@ -34,9 +34,12 @@
},
env : {
p_clipboard_write : (size, text) => {
+ let text_buffer = new ArrayBuffer(size);
+ new Uint8Array(text_buffer).set(new Uint8Array(this.memory_buffer, text, size));
+
this.port.postMessage({
- id : "clipboard",
- text : new TextDecoder("utf8").decode(new Uint8Array(this.memory_buffer, text, size)), // FIXME
+ id : "clipboard",
+ text_buffer : text_buffer,
});
},
p_time_impl : Date.now,
@@ -370,7 +373,7 @@
},
clipboard : (ev) => {
- navigator.clipboard.writeText(ev.text);
+ navigator.clipboard.writeText(new TextDecoder("utf8").decode(new Uint8Array(ev.text_buffer)));
},
frame : (ev) => {
@@ -424,7 +427,7 @@
});
});
- canvas.addEventListener("keydown", (ev) => {
+ window.addEventListener("keydown", (ev) => {
ev.preventDefault();
if (!sound_ready)
return;
@@ -435,6 +438,8 @@
if (key == 0)
return;
+ console.log(ev);
+
sound_node.port.postMessage({
id : "keydown",
mod : mod,
@@ -442,7 +447,7 @@
});
});
- canvas.addEventListener("keyup", (ev) => {
+ window.addEventListener("keyup", (ev) => {
ev.preventDefault();
if (!sound_ready)
return;