Skip to content

Commit

Permalink
Calc: change shiftHandler to arrow function
Browse files Browse the repository at this point in the history
to automatically bind 'this'.

Signed-off-by: Bayram Çiçek <[email protected]>
Change-Id: Ie80b750ade42c72285c116c0a0b75d6f9e0fa38c
  • Loading branch information
bayramcicek committed Jan 28, 2025
1 parent ae3f27a commit 88e852a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions browser/src/control/jsdialog/Util.ScrollableBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function setupResizeHandler(container: Element, scrollable: Element) {

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

Expand All @@ -89,13 +89,14 @@ function setupResizeHandler(container: Element, scrollable: Element) {
timer = setTimeout(function () {
JSDialog.RefreshScrollables();
}, 350);
}.bind(this);
};

window.addEventListener('resize', handler);
window.addEventListener('scroll', handler);
document
.querySelector('.ui-scrollable-content')
.addEventListener('wheel', shiftHandler);
const scrollableContent = container.querySelector(
'.ui-scrollable-content',
) as HTMLElement;
scrollableContent.addEventListener('wheel', shiftHandler);
}

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

0 comments on commit 88e852a

Please sign in to comment.