From a770ab9b6b82c5eee30750aa7fb7040d0b0f6ef4 Mon Sep 17 00:00:00 2001 From: ALi Date: Tue, 13 Sep 2022 15:46:56 +0200 Subject: [PATCH] feat(Grid): Check touch device by media query --- src/components/Grid/index.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Grid/index.jsx b/src/components/Grid/index.jsx index a118f0d..cdb9438 100644 --- a/src/components/Grid/index.jsx +++ b/src/components/Grid/index.jsx @@ -74,7 +74,7 @@ export function Grid({ startZ = undefined, distance = 8, reverse = false, startR {springs[i].map(({ scale, opacity }, j) => ( { - if (!('ontouchstart' in window)) { + if (!window.matchMedia('(pointer: coarse)').matches) { apis[i].start((index) => { if (index === j) { return { scale: [1.1, 1.1, 1], opacity: 0.5 } @@ -94,7 +94,7 @@ export function Grid({ startZ = undefined, distance = 8, reverse = false, startR }) }} onPointerLeave={() => { - if (!('ontouchstart' in window)) { + if (!window.matchMedia('(pointer: coarse)').matches) { apis[i].start(() => ({ scale: [1, 1, 1], opacity: 0.2 })) } }}>