setting to disable remote tilt

This commit is contained in:
Gavin McDonald
2025-07-01 16:43:40 -04:00
parent f61ca0d0a1
commit 4ec4ac0242
2 changed files with 42 additions and 27 deletions

View File

@@ -41,16 +41,18 @@ export function AppProvider({ children }: { children: ReactNode }) {
});
useEffect(() => {
const cardIndex = tilt.findIndex((tilt) => !!tilt);
if (localSettings.remoteTilt) {
const cardIndex = tilt.findIndex((tilt) => !!tilt);
if (tilt[cardIndex]) {
emitTilt(cardIndex, tilt[cardIndex]);
} else {
// cardIndex does not matter
// all tilts for this user will be cleared
emitTilt(0, { rotateX: 0, rotateY: 0 });
if (tilt[cardIndex]) {
emitTilt(cardIndex, tilt[cardIndex]);
} else {
// cardIndex does not matter
// all tilts for this user will be cleared
emitTilt(0, { rotateX: 0, rotateY: 0 });
}
}
}, [tilt]);
}, [tilt, localSettings]);
const handleSelect = (cardID: string) => {
setSelectCardIndex(-1);