Skip to content

Commit 4f55a55

Browse files
committed
feat: mousewheel change to wheel
1 parent d02032d commit 4f55a55

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ViewerCore.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
138138
// Though onWheel can be directly used on the div "viewerCore", to be able to
139139
// prevent default action, a listener is added here instead
140140
(this.refs['viewerCore'] as HTMLDivElement).addEventListener(
141-
'mousewheel',
141+
'wheel',
142142
this.handleMouseScroll,
143143
false,
144144
);
@@ -560,10 +560,11 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
560560
}
561561
e.preventDefault();
562562
let direct: 0 | 1 | -1 = 0;
563-
if (e.deltaY === 0) {
563+
const value = e.deltaY;
564+
if (value === 0) {
564565
direct = 0;
565566
} else {
566-
direct = e.deltaY > 0 ? -1 : 1;
567+
direct = value > 0 ? -1 : 1;
567568
}
568569
if (direct !== 0) {
569570
let x = e.clientX;

0 commit comments

Comments
 (0)