Skip to content

Commit

Permalink
fix: fix canvas focusing
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Oct 28, 2023
1 parent 4de2306 commit 7b10739
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { AnimatePresence, motion } from 'framer-motion'
import { useAtomValue } from 'jotai'
import { detectHasRunningGame } from '../../../../core'
import { SpatialNavigation } from '../../../lib/spatial-navigation'
import { isGameRunningAtom, showMenuOverlayAtom } from '../../atoms'
import { useMouseMoving } from './hooks'

function isTouchDevice() {
return 'ontouchstart' in window || navigator.maxTouchPoints > 0
}

function focusCanvas() {
SpatialNavigation.focus('canvas')
}

export function MenuEntryButton({ onClick }: { onClick: () => void }) {
const isGameRunning = useAtomValue(isGameRunningAtom)
const showMenuOverlay = useAtomValue(showMenuOverlayAtom)
Expand All @@ -27,6 +32,7 @@ export function MenuEntryButton({ onClick }: { onClick: () => void }) {
className='fixed inset-0 z-20 flex items-end justify-center bg-gradient-to-b from-transparent from-80% to-black/80'
exit={{ opacity: 0 }}
initial={{ opacity: 0 }}
onClick={focusCanvas}
transition={{ duration: 0.1 }}
>
<div
Expand Down

0 comments on commit 7b10739

Please sign in to comment.