Skip to content

Commit aa1c516

Browse files
committed
fix squished camera output, add onCapture callback
1 parent b02fbb3 commit aa1c516

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/tools/Camera/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ import { useLimitedFrame } from "../../logic";
2020
const AUDIO_URL =
2121
"https://d27rt3a60hh1lx.cloudfront.net/tools/camera/shutter-sound.mp3";
2222

23-
export function Camera() {
23+
type CameraProps = { onCapture?: () => void };
24+
25+
export function Camera(props: CameraProps) {
26+
const { onCapture } = props;
27+
2428
const { device, paused } = useEnvironment();
2529
const { scene } = useThree();
2630
const toolbelt = useToolbelt();
@@ -62,6 +66,7 @@ export function Camera() {
6266
const audio = new Audio(AUDIO_URL);
6367
audio.play();
6468
photo.takePicture();
69+
if (onCapture) onCapture();
6570
};
6671

6772
useEffect(() => {

src/tools/Camera/utils/photo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export const usePhotography = (
5656
r.toneMapping = ACESFilmicToneMapping;
5757

5858
document.body.append(r.domElement);
59+
cam.current.aspect = aspect.x / aspect.y;
5960

6061
r.render(scene, cam.current);
6162

0 commit comments

Comments
 (0)