From 9e739c2a21692e9b88cbd96314b031673fdd877e Mon Sep 17 00:00:00 2001 From: takuma-hmng8 Date: Sat, 18 May 2024 12:42:52 +0900 Subject: [PATCH 1/3] change to onPointerDown --- app/layout.tsx | 8 +++++++- app/stickers/Playground.tsx | 13 ++++++++++--- app/stickers/StickerBall/index.tsx | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 2aa1ac72..4eb4f741 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -20,7 +20,13 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( - + {children} diff --git a/app/stickers/Playground.tsx b/app/stickers/Playground.tsx index e005b07b..365bd34d 100644 --- a/app/stickers/Playground.tsx +++ b/app/stickers/Playground.tsx @@ -2,7 +2,7 @@ import * as THREE from "three"; import { memo } from "react"; -import { Environment, OrbitControls } from "@react-three/drei"; +import { CameraControls, Environment, OrbitControls } from "@react-three/drei"; import { useFrame } from "@react-three/fiber"; import { useStickers } from "./useStickers"; import { CanvasState } from "./CanvasState"; @@ -31,7 +31,7 @@ export const Playground = () => { const canvasState = CanvasState.getInstance(); - useFrame(({ camera, clock }, delta) => { + useFrame(({ camera, clock, controls }, delta) => { if (!isReady) { return; } @@ -68,7 +68,14 @@ export const Playground = () => { silhouetteMap={silhouette} /> - {/* */} + ); }; diff --git a/app/stickers/StickerBall/index.tsx b/app/stickers/StickerBall/index.tsx index 724fb6b4..3646719d 100644 --- a/app/stickers/StickerBall/index.tsx +++ b/app/stickers/StickerBall/index.tsx @@ -23,7 +23,7 @@ const StickerBallMesh = ({ children }: { children: React.ReactNode }) => { return ( { + onPointerDown={(e) => { canvasState.setStickerState(e.uv!); canvasState.cameraState.point.set( e.point.x, From f3db8a540ee05cf822cf12db360fabf5cc297809 Mon Sep 17 00:00:00 2001 From: takuma-hmng8 Date: Sat, 18 May 2024 12:43:35 +0900 Subject: [PATCH 2/3] change to onPointerDown --- app/stickers/Playground.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/stickers/Playground.tsx b/app/stickers/Playground.tsx index 365bd34d..4dae0356 100644 --- a/app/stickers/Playground.tsx +++ b/app/stickers/Playground.tsx @@ -2,7 +2,7 @@ import * as THREE from "three"; import { memo } from "react"; -import { CameraControls, Environment, OrbitControls } from "@react-three/drei"; +import { Environment, OrbitControls } from "@react-three/drei"; import { useFrame } from "@react-three/fiber"; import { useStickers } from "./useStickers"; import { CanvasState } from "./CanvasState"; From 1965b297cc93470d5821ee412cfa61577d7f9b89 Mon Sep 17 00:00:00 2001 From: takuma-hmng8 Date: Sat, 18 May 2024 12:44:06 +0900 Subject: [PATCH 3/3] change to onPointerDown --- app/stickers/Playground.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/stickers/Playground.tsx b/app/stickers/Playground.tsx index 4dae0356..112411ef 100644 --- a/app/stickers/Playground.tsx +++ b/app/stickers/Playground.tsx @@ -31,7 +31,7 @@ export const Playground = () => { const canvasState = CanvasState.getInstance(); - useFrame(({ camera, clock, controls }, delta) => { + useFrame(({ camera, clock }, delta) => { if (!isReady) { return; }