Skip to content

Commit

Permalink
Refactor mouseInfo #7584
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Dec 28, 2023
1 parent 8394651 commit 3f5bf0d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ export const IsMobile = _isMobile || _IPad;

export var mouseInfo = {
get isTouch(): boolean {
if(this.hasMouse) return false;
return this.hasTouchEvent;
return !this.hasMouse && this.hasTouchEvent;
},
get hasTouchEvent(): boolean {
return typeof window !== "undefined" && "ontouchstart" in (<any>window) || navigator.maxTouchPoints > 0;
return typeof window !== "undefined" && ("ontouchstart" in (<any>window) || navigator.maxTouchPoints > 0);
},
hasMouse: true
};
Expand Down

0 comments on commit 3f5bf0d

Please sign in to comment.