Skip to content

Commit 88e852a

Browse files
committed
Calc: change shiftHandler to arrow function
to automatically bind 'this'. Signed-off-by: Bayram Çiçek <[email protected]> Change-Id: Ie80b750ade42c72285c116c0a0b75d6f9e0fa38c
1 parent ae3f27a commit 88e852a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function setupResizeHandler(container: Element, scrollable: Element) {
8080

8181
// handler for toolbar and statusbar
8282
// runs if shift + mouse wheel up/down are used
83-
const shiftHandler = function (e: MouseEvent) {
83+
const shiftHandler = (e: MouseEvent) => {
8484
const rootContainer = scrollable.querySelector('div');
8585
if (!rootContainer || !e.shiftKey) return;
8686

@@ -89,13 +89,14 @@ function setupResizeHandler(container: Element, scrollable: Element) {
8989
timer = setTimeout(function () {
9090
JSDialog.RefreshScrollables();
9191
}, 350);
92-
}.bind(this);
92+
};
9393

9494
window.addEventListener('resize', handler);
9595
window.addEventListener('scroll', handler);
96-
document
97-
.querySelector('.ui-scrollable-content')
98-
.addEventListener('wheel', shiftHandler);
96+
const scrollableContent = container.querySelector(
97+
'.ui-scrollable-content',
98+
) as HTMLElement;
99+
scrollableContent.addEventListener('wheel', shiftHandler);
99100
}
100101

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

0 commit comments

Comments
 (0)