Skip to content

Commit

Permalink
fix event type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Sep 5, 2023
1 parent 59bff60 commit 9f0d474
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bundled/lenis.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@
event = _ref2.event;
// keep zoom feature
if (event.ctrlKey) return;
var isTouch = event instanceof TouchEvent;
var isWheel = event instanceof WheelEvent;
var isTouch = event.type.includes('touch');
var isWheel = event.type.includes('wheel');
if (_this.options.gestureOrientation === 'vertical' && deltaY === 0 ||
// trackpad previous/next page gesture
_this.options.gestureOrientation === 'horizontal' && deltaX === 0 || isTouch && _this.options.gestureOrientation === 'vertical' && _this.scroll === 0 && !_this.options.infinite && deltaY <= 0 // touch pull to refresh
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export default class Lenis {
// keep zoom feature
if (event.ctrlKey) return

const isTouch = event instanceof TouchEvent
const isWheel = event instanceof WheelEvent
const isTouch = event.type.includes('touch')
const isWheel = event.type.includes('wheel')

if (
(this.options.gestureOrientation === 'vertical' && deltaY === 0) || // trackpad previous/next page gesture
Expand Down

2 comments on commit 9f0d474

@vercel
Copy link

@vercel vercel bot commented on 9f0d474 Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"⚡️ Lighthouse report for the changes in this commit:

🔴 Performance: 37
🟠 Accessibility: 88
🟢 Best practices: 100
🟠 SEO: 67
🔴 PWA: 0

Lighthouse ran on https://greensock.com/requires-membership/?plugin=SplitText&source=trial"

Please sign in to comment.