feat: publish HoloLake model-native living system source
This commit is contained in:
parent
6ad10edde1
commit
c395dd3a99
2467 changed files with 615073 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
import { useEffect } from 'react'
|
||||
|
||||
/**
|
||||
* Registers mouse button 3/4 (back/forward) navigation.
|
||||
* The horizontal trackpad swipe path was removed because it was firing
|
||||
* unreliably in WKWebView and conflicted with the explicit keyboard path.
|
||||
*/
|
||||
export function useNavigationGestures({
|
||||
onGoBack,
|
||||
onGoForward,
|
||||
}: {
|
||||
onGoBack: () => void
|
||||
onGoForward: () => void
|
||||
}) {
|
||||
useEffect(() => {
|
||||
const handleMouseNavigation = (event: MouseEvent) => {
|
||||
if (event.button === 3) {
|
||||
event.preventDefault()
|
||||
onGoBack()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.button === 4) {
|
||||
event.preventDefault()
|
||||
onGoForward()
|
||||
}
|
||||
}
|
||||
window.addEventListener('mouseup', handleMouseNavigation)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('mouseup', handleMouseNavigation)
|
||||
}
|
||||
}, [onGoBack, onGoForward])
|
||||
}
|
||||
Loading…
Reference in a new issue