summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/index.js43
1 files changed, 21 insertions, 22 deletions
diff --git a/client/index.js b/client/index.js
index 4ca290b..59d67f3 100644
--- a/client/index.js
+++ b/client/index.js
@@ -248,8 +248,9 @@ function add(i, j) {
} else {
div.addEventListener("touchstart", function (e) {
e.preventDefault();
- toggle(note);
- erasing = !note.playing;
+ trigger(note);
+ // erasing = !note.playing;
+ dragging = true;
lastNote = note;
});
}
@@ -280,11 +281,7 @@ function bind() {
const note = notes[x][y];
if (note !== lastNote) {
if (dragging) {
- if (erasing) {
- pause(note);
- } else {
- toggle(note);
- }
+ trigger(note);
}
lastNote = note;
}
@@ -306,21 +303,23 @@ function bind() {
.addEventListener("click", () =>
document.querySelector("#help").classList.toggle("visible"),
);
- grid.addEventListener("wheel", (e) => {
- const new_base_x = Math.max(0, base_x + e.deltaX / 32);
- const new_base_y = Math.max(0, base_y + e.deltaY / 32);
- if (
- Math.round(base_x) !== Math.round(new_base_x) ||
- Math.round(base_y) !== Math.round(new_base_y)
- ) {
- base_x = new_base_x;
- base_y = new_base_y;
- rebuild();
- } else {
- base_x = new_base_x;
- base_y = new_base_y;
- }
- });
+ if (browser.isDesktop) {
+ grid.addEventListener("wheel", (e) => {
+ const new_base_x = Math.max(0, base_x + e.deltaX / 32);
+ const new_base_y = Math.max(0, base_y + e.deltaY / 32);
+ if (
+ Math.round(base_x) !== Math.round(new_base_x) ||
+ Math.round(base_y) !== Math.round(new_base_y)
+ ) {
+ base_x = new_base_x;
+ base_y = new_base_y;
+ rebuild();
+ } else {
+ base_x = new_base_x;
+ base_y = new_base_y;
+ }
+ });
+ }
}
let isReset = false;