-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(JMX-3428): [SubMenu] support touch interaction on mobile
- Loading branch information
1 parent
0cf4a91
commit 641c74c
Showing
4 changed files
with
129 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { TouchEvent } from 'react'; | ||
|
||
/** | ||
* @param event TouchEndEvent | ||
*/ | ||
export const isTap = (event: TouchEvent) => { | ||
if (event.touches.length < 2 && event.changedTouches.length < 2) { | ||
const touch = event.touches[0] || event.changedTouches[0]; | ||
|
||
const elm = document.elementFromPoint( | ||
touch.clientX, | ||
touch.clientY, | ||
) as HTMLElement | null; | ||
|
||
return event.currentTarget === elm || event.currentTarget.contains(elm); | ||
} | ||
|
||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"latestCommitSHA": "d63b648605ed42ca105877421c378cbe6e4e1917" | ||
"latestCommitSHA": "5f7dffde66d522257b0f3c7e2564914d104f0646" | ||
} |