From 9b2a34c53dc5bc3304d2f2fa01bef7728fbf84e6 Mon Sep 17 00:00:00 2001
From: Olivia206 <olivia.simonet206@gmail.com>
Date: Fri, 23 Feb 2024 11:47:15 +0100
Subject: [PATCH] fixed horizontal scrolling

---
 assets/js/theme/blocks/draggableBlocks.js | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/assets/js/theme/blocks/draggableBlocks.js b/assets/js/theme/blocks/draggableBlocks.js
index 86281326..661ad5ce 100644
--- a/assets/js/theme/blocks/draggableBlocks.js
+++ b/assets/js/theme/blocks/draggableBlocks.js
@@ -98,13 +98,16 @@ class DraggableBlock {
 
     handleScroll() {
         this.content.addEventListener('wheel', (event) => {
-            const delta = event.deltaX;
-
-            if (delta !== 0) {
-                if (delta > 0) {
-                    this.goTo(this.index+1);
-                } else {
-                    this.goTo(this.index-1);
+            const deltaX = event.deltaX;
+            const deltaY = event.deltaY;
+
+            if (Math.abs(deltaX) > Math.abs(deltaY)) {
+                if (deltaX !== 0) {
+                    if (deltaX > 0) {
+                        this.goTo(this.index + 1);
+                    } else {
+                        this.goTo(this.index - 1);
+                    }
                 }
             }
         });
-- 
GitLab