check if mouse if set

This commit is contained in:
cupcakearmy 2019-08-27 23:33:34 +02:00
parent 2ea30235ab
commit db3ce2e53a

View File

@ -1,5 +1,7 @@
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
type Size = { width: number, height: number } type Size = { width: number, height: number }
export const useInnerWindowSize = (): Size => { export const useInnerWindowSize = (): Size => {
const getCurrentSize = (): Size => ({ const getCurrentSize = (): Size => ({
@ -19,7 +21,7 @@ export const useInnerWindowSize = (): Size => {
} }
export const useIsMousePresent = () => { export const useIsMousePresent = () => {
let [present, setPresent] = useState<boolean>(false) let [present, setPresent] = useState<boolean>(!('ontouchstart' in window) && ('onmousemove' in window))
useEffect(() => { useEffect(() => {
const enter = () => setPresent(true) const enter = () => setPresent(true)