removed support for touch screens

This commit is contained in:
killerboss 2024-10-31 19:30:51 +01:00
parent d0b92e6a49
commit 2bb35da1ba

View file

@ -43,9 +43,11 @@ export function CursorProvider ({ hidden, enabled, children }) {
}; };
}, []); }, []);
const isTouchDevice = "ontouchstart" in window;
useEffect(() => { useEffect(() => {
const htmlElement = document.documentElement; const htmlElement = document.documentElement;
if (isCursorEnabled) { if (isCursorEnabled & !isTouchDevice) {
htmlElement.classList.add('custom-cursor-enabled-env'); htmlElement.classList.add('custom-cursor-enabled-env');
} else { } else {
htmlElement.classList.remove('custom-cursor-enabled-env'); htmlElement.classList.remove('custom-cursor-enabled-env');
@ -55,7 +57,7 @@ export function CursorProvider ({ hidden, enabled, children }) {
return ( return (
<> <>
<CursorContext.Provider value={{isCustomCursorHidden: isCursorHidden, isCustomCursorEnabled: isCursorEnabled, toggleCursor, toggleCursorEnabled}}> <CursorContext.Provider value={{isCustomCursorHidden: isCursorHidden, isCustomCursorEnabled: isCursorEnabled, toggleCursor, toggleCursorEnabled}}>
{isCursorEnabled ? {isCursorEnabled & !isTouchDevice ?
<div <div
ref={cursorRef} ref={cursorRef}
className={`pointer-events-none fixed top-0 left-0 ${isCursorHidden || !isCursorEnabled || !isCursorInViewport ? 'invisible' : ''} w-10 h-10 bg-white rounded-full z-50 mix-blend-difference`} className={`pointer-events-none fixed top-0 left-0 ${isCursorHidden || !isCursorEnabled || !isCursorInViewport ? 'invisible' : ''} w-10 h-10 bg-white rounded-full z-50 mix-blend-difference`}