Skip to content

Commit

Permalink
fix: add haptic feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
posaune0423 committed Sep 27, 2024
1 parent 8d09617 commit 84bd0ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"tailwindcss-animate": "^1.0.7",
"twgl.js": "^5.5.4",
"use-debounce": "^10.0.3",
"use-haptic": "^1.0.1",
"use-sound": "^4.0.3"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/components/PixelViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useWebGL } from "@/hooks/useWebGL";
import { CoordinateFinder } from "@/components/CoordinateFinder";
import { ColorPalette } from "@/components/ColorPallette";
import { CanvasGrid } from "@/components/CanvasGrid";
import { useHaptic } from "use-haptic";

export const PixelViewer: React.FC = () => {
// Refs
Expand All @@ -28,6 +29,7 @@ export const PixelViewer: React.FC = () => {
connectedAccount,
},
} = useDojo();
const { vibe } = useHaptic();

const { gridState, setGridState } = useGridState();
const { drawPixels } = useWebGL(canvasRef, gridState);
Expand All @@ -42,6 +44,7 @@ export const PixelViewer: React.FC = () => {
startTransition(async () => {
setOptimisticPixels({ x, y, color: selectedColor });
play();
vibe();
await interact(activeAccount, {
for_player: 0n,
for_system: 0n,
Expand All @@ -50,7 +53,7 @@ export const PixelViewer: React.FC = () => {
});
});
},
[selectedColor, activeAccount, interact, setOptimisticPixels, play]
[selectedColor, activeAccount, interact, setOptimisticPixels, play, vibe]
);

const onDrawGrid = useCallback(() => {
Expand Down

0 comments on commit 84bd0ac

Please sign in to comment.