From dd77b5bcbbe923c55041f747013346f29be00b8e Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Fri, 1 Jun 2018 21:48:26 +0200
Subject: [PATCH] Revert smooth scrolling fix and rewrite horizontal scrolling
 fix to avoid column jumping

---
 Resources/Scripts/code.js | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js
index 3cb34f4a..48a4b155 100644
--- a/Resources/Scripts/code.js
+++ b/Resources/Scripts/code.js
@@ -1374,11 +1374,19 @@
   }
   
   //
-  // Block: Remove column mouse wheel handler, which allows smooth scrolling inside columns, and horizontally scrolling column container when holding Shift.
+  // Block: Fix broken horizontal scrolling of column container when holding Shift. TODO Fix broken smooth scrolling.
   //
   if (ensurePropertyExists(TD, "ui", "columns", "setupColumnScrollListeners")){
-    TD.ui.columns.setupColumnScrollListeners = appendToFunction(TD.ui.columns.setupColumnScrollListeners, function(e){
-      $(".js-column[data-column='"+e.model.getKey()+"']").off("mousewheel onmousewheel");
+    TD.ui.columns.setupColumnScrollListeners = appendToFunction(TD.ui.columns.setupColumnScrollListeners, function(column){
+      let ele = $(".js-column[data-column='"+column.model.getKey()+"']");
+      
+      ele.off("onmousewheel").on("mousewheel", ".scroll-v", function(e){
+        if (e.shiftKey){
+          e.stopImmediatePropagation();
+        }
+      });
+      
+      window.TDGF_prioritizeNewestEvent(ele[0], "mousewheel");
     });
   }