diff --git a/2048.html b/2048.html
index 2fbfa3d..047579f 100644
--- a/2048.html
+++ b/2048.html
@@ -3,7 +3,7 @@
- 2048 - Neon Edition
+ 2048
diff --git a/2048_Controls.js b/2048_Controls.js
index 2a11374..3aa7108 100644
--- a/2048_Controls.js
+++ b/2048_Controls.js
@@ -1,8 +1,13 @@
/* ------------------------
6. INPUT HANDLER
- ------------------------ */
+ ------------------------
+ */
+
+let inputLocked = false;
+
function handleKey(e) {
- if (isMoving) return;
+ if (isMoving || inputLocked) return; // ⛔ BLOK kalau sedang buka sound panel
+
let moved = false;
const k = e.key;
@@ -35,19 +40,23 @@ function handleKey(e) {
let touchStartX = 0;
let touchStartY = 0;
+
document.addEventListener("touchstart", function (e) {
+ if (inputLocked) return; // ⛔ jangan catat swipe
+
const t = e.touches[0];
touchStartX = t.clientX;
touchStartY = t.clientY;
}, { passive: true });
+
document.addEventListener("touchend", function (e) {
- if (isMoving) return;
+ if (isMoving || inputLocked) return; // ⛔ swipe diblok saat sound panel aktif
const t = e.changedTouches[0];
const dx = t.clientX - touchStartX;
const dy = t.clientY - touchStartY;
-
+
let moved = false;
if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 30) {
diff --git a/Audio_2048.js b/Audio_2048.js
index 2ba8b53..807377b 100644
--- a/Audio_2048.js
+++ b/Audio_2048.js
@@ -120,20 +120,22 @@ function setupVolumePanelEvents() {
if (isActive) {
volumePanel.classList.remove('active');
- if (volumeBackdrop) volumeBackdrop.classList.remove('active');
+ if (volumeBackdrop) volumeBackdrop.classList.remove('active');
+ inputLocked = false; // 🔓 buka panel -> input kembali
} else {
volumePanel.classList.add('active');
if (volumeBackdrop) volumeBackdrop.classList.add('active');
+ inputLocked = true; // 🔒 panel sound aktif -> swipe & keyboard mati
}
});
// Close when clicking backdrop
- if (volumeBackdrop) {
- volumeBackdrop.addEventListener('click', () => {
- volumePanel.classList.remove('active');
- volumeBackdrop.classList.remove('active');
+ volumeBackdrop.addEventListener('click', () => {
+ volumePanel.classList.remove('active');
+ volumeBackdrop.classList.remove('active');
+ inputLocked = false; // 🔓 unlock
});
- }
+
// Close when clicking outside (desktop)
document.addEventListener('click', (e) => {
@@ -142,6 +144,7 @@ function setupVolumePanelEvents() {
(!volumeBackdrop || !volumeBackdrop.contains(e.target))) {
volumePanel.classList.remove('active');
if (volumeBackdrop) volumeBackdrop.classList.remove('active');
+ inputLocked = false; // 🔓 unlock input
}
});