Skip to content

Commit ae3f27a

Browse files
committed
Calc: show/hide scroll buttons correctly with shift + mouse wheel
- 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 <[email protected]> Change-Id: I60608a8a1395d87911c520d265fce0c3b25d8da4
1 parent 5fdd3a9 commit ae3f27a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

browser/src/control/jsdialog/Util.ScrollableBar.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ function showArrow(arrow: HTMLElement, show: boolean) {
4848
function setupResizeHandler(container: Element, scrollable: Element) {
4949
const left = container.querySelector('.ui-scroll-left') as HTMLElement;
5050
const right = container.querySelector('.ui-scroll-right') as HTMLElement;
51-
var isRTL = document.documentElement.dir === 'rtl';
51+
var isRTL: boolean = document.documentElement.dir === 'rtl';
52+
var timer: any; // for shift + mouse wheel up/down
5253

5354
const handler = function () {
5455
const rootContainer = scrollable.querySelector('div');
@@ -77,8 +78,24 @@ function setupResizeHandler(container: Element, scrollable: Element) {
7778
}
7879
}.bind(this);
7980

81+
// handler for toolbar and statusbar
82+
// runs if shift + mouse wheel up/down are used
83+
const shiftHandler = function (e: MouseEvent) {
84+
const rootContainer = scrollable.querySelector('div');
85+
if (!rootContainer || !e.shiftKey) return;
86+
87+
clearTimeout(timer);
88+
// wait until mouse wheel stops scrolling
89+
timer = setTimeout(function () {
90+
JSDialog.RefreshScrollables();
91+
}, 350);
92+
}.bind(this);
93+
8094
window.addEventListener('resize', handler);
8195
window.addEventListener('scroll', handler);
96+
document
97+
.querySelector('.ui-scrollable-content')
98+
.addEventListener('wheel', shiftHandler);
8299
}
83100

84101
JSDialog.MakeScrollable = function (parent: Element, scrollable: Element) {

0 commit comments

Comments
 (0)