From 5003565a12d578b81aa30b04b785b0b33186bff3 Mon Sep 17 00:00:00 2001 From: "Ghislain B." Date: Sat, 11 Jan 2025 17:03:43 -0500 Subject: [PATCH] fix: shift+mousewheel should scroll horizontally, fixes #1094 (#1096) --- src/slick.grid.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/slick.grid.ts b/src/slick.grid.ts index 0a86a86d..ec6b7d8f 100644 --- a/src/slick.grid.ts +++ b/src/slick.grid.ts @@ -5405,8 +5405,12 @@ export class SlickGrid = Column, O e protected handleMouseWheel(e: MouseEvent, _delta: number, deltaX: number, deltaY: number) { this.scrollHeight = this._viewportScrollContainerY.scrollHeight; - this.scrollTop = Math.max(0, this._viewportScrollContainerY.scrollTop - (deltaY * this._options.rowHeight!)); - this.scrollLeft = this._viewportScrollContainerX.scrollLeft + (deltaX * 10); + if (e.shiftKey) { + this.scrollLeft = this._viewportScrollContainerX.scrollLeft + (deltaX * 10); + } else { + this.scrollTop = Math.max(0, this._viewportScrollContainerY.scrollTop - (deltaY * this._options.rowHeight!)); + this.scrollLeft = this._viewportScrollContainerX.scrollLeft + (deltaX * 10); + } const handled = this._handleScroll('mousewheel'); if (handled) { e.preventDefault();