Skip to content

Commit 22ac50e

Browse files
committed
Fix smoothscroll issue on wheel events
1 parent 29a7ef1 commit 22ac50e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/web-gpu-canvas.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ export const WebGPUCanvas: React.FC<WebGPUCanvasProps> = (props) => {
173173
};
174174
const wheel = (evt: WheelEvent) => {
175175
if (evt.deltaY != 0) {
176-
if (Reflect.has(evt, "wheelDelta")) {
177-
const delta = evt.deltaY / Math.abs(Number((evt as any).wheelDelta));
176+
const wheelDelta = Number((evt as any).wheelDelta);
177+
if (!isNaN(wheelDelta)) {
178+
const delta = evt.deltaY / Math.max(1, Math.abs(wheelDelta));
178179
changeView({
179180
z: Math.min(Math.max(-1, view.current.z - delta / 50), 1),
180181
});

0 commit comments

Comments
 (0)