Skip to content

Commit

Permalink
feat(Grid): Check touch device by media query
Browse files Browse the repository at this point in the history
  • Loading branch information
alimoezzi committed Sep 13, 2022
1 parent 26dc0cb commit a770ab9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Grid/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function Grid({ startZ = undefined, distance = 8, reverse = false, startR
{springs[i].map(({ scale, opacity }, j) => (
<group
onPointerOver={() => {
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 }
Expand All @@ -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 }))
}
}}>
Expand Down

0 comments on commit a770ab9

Please sign in to comment.