From 7b05e435d61e1ec598a3c074f7310a76acc78127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20=C3=87i=C3=A7ek?= <bayram.cicek@collabora.com> Date: Tue, 21 Jan 2025 12:48:34 +0300 Subject: [PATCH] Calc: show/hide scroll buttons correctly with shift + mouse wheel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Scrolling toolbar and statusbar with Shift + mouseWheelUp/Down does not hide/show the scroll right/left buttons correctly. Therefore, right/left buttons overlap with other elements. All issues are fixed. Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com> Change-Id: I60608a8a1395d87911c520d265fce0c3b25d8da4 --- .../control/jsdialog/Util.ScrollableBar.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/browser/src/control/jsdialog/Util.ScrollableBar.ts b/browser/src/control/jsdialog/Util.ScrollableBar.ts index 18a46c4548a5b..13d9382ebd317 100644 --- a/browser/src/control/jsdialog/Util.ScrollableBar.ts +++ b/browser/src/control/jsdialog/Util.ScrollableBar.ts @@ -48,7 +48,8 @@ function showArrow(arrow: HTMLElement, show: boolean) { function setupResizeHandler(container: Element, scrollable: Element) { const left = container.querySelector('.ui-scroll-left') as HTMLElement; const right = container.querySelector('.ui-scroll-right') as HTMLElement; - var isRTL = document.documentElement.dir === 'rtl'; + var isRTL: boolean = document.documentElement.dir === 'rtl'; + var timer: any; // for shift + mouse wheel up/down const handler = function () { const rootContainer = scrollable.querySelector('div'); @@ -77,8 +78,24 @@ function setupResizeHandler(container: Element, scrollable: Element) { } }.bind(this); + // handler for toolbar and statusbar + // runs if shift + mouse wheel up/down are used + const shiftHandler = function (e: MouseEvent) { + const rootContainer = scrollable.querySelector('div'); + if (!rootContainer || !e.shiftKey) return; + + clearTimeout(timer); + // wait until mouse wheel stops scrolling + timer = setTimeout(function () { + JSDialog.RefreshScrollables(); + }, 350); + }.bind(this); + window.addEventListener('resize', handler); window.addEventListener('scroll', handler); + document + .querySelector('.ui-scrollable-content') + .addEventListener('wheel', shiftHandler); } JSDialog.MakeScrollable = function (parent: Element, scrollable: Element) {