@@ -3,7 +3,6 @@ import Webcam from "react-webcam";
3
3
import { Hands , HAND_CONNECTIONS } from "@mediapipe/hands/hands" ;
4
4
import { drawConnectors , drawLandmarks } from "@mediapipe/drawing_utils/drawing_utils" ;
5
5
import { Camera } from "@mediapipe/camera_utils/camera_utils" ;
6
- import "./MediapipeHands.css"
7
6
import { detectHandGesture } from "./HandGesture" ;
8
7
import { preprocessImage } from "./PreprocessImage" ;
9
8
import frame from "./frame.png" ;
@@ -25,7 +24,6 @@ const GameScreen = forwardRef((props, ref) => {
25
24
} ) )
26
25
27
26
28
-
29
27
// 웹캡 변수
30
28
const webcamRef = useRef ( null ) ;
31
29
const canvasRef = useRef ( null ) ;
@@ -259,10 +257,6 @@ const GameScreen = forwardRef((props, ref) => {
259
257
function rect ( r ) {
260
258
const image = new Image ( ) ;
261
259
image . src = r . fill ;
262
- // canvasRef4.current.getContext('2d').fillStyle = image;
263
- // canvasRef4.current.getContext('2d').fillRect(r.x, r.y, r.width, r.height);
264
- // const image = new Image();
265
- // image.src = r.fill;
266
260
image . onload = function ( ) {
267
261
canvasRef4 . current . getContext ( '2d' ) . drawImage ( image , r . x , r . y , r . width , r . height ) ;
268
262
}
@@ -353,14 +347,9 @@ const GameScreen = forwardRef((props, ref) => {
353
347
const mx = parseInt ( nativeEvent . clientX - canvasOffSetX . current ) ;
354
348
const my = parseInt ( nativeEvent . clientY - canvasOffSetY . current ) ;
355
349
356
- // calculate the distance the mouse has moved
357
- // since the last mousemove
358
350
const dx = mx - startX ;
359
351
const dy = my - startY ;
360
352
361
- // move each rect that isDragging
362
- // by the distance the mouse has moved
363
- // since the last mousemove
364
353
for ( let i = 0 ; i < shapes . current . length ; i ++ ) {
365
354
const s = shapes . current [ i ] ;
366
355
if ( s . isDragging ) {
@@ -482,17 +471,6 @@ const GameScreen = forwardRef((props, ref) => {
482
471
// img.crossOrigin = "anonymous";
483
472
img . src = canvas . toDataURL ( 'image/png' ) ;
484
473
485
-
486
- // var blobBin = atob(img.src.split(',')[1]); // base64 데이터 디코딩
487
- // var array = [];
488
- // for (var i = 0; i < blobBin.length; i++) {
489
- // array.push(blobBin.charCodeAt(i));
490
- // }
491
-
492
- // var file = new Blob([new Uint8Array(array)], { type: 'image/png' }); // Blob 생성
493
- // const image = URL.createObjectURL(file);
494
-
495
-
496
474
//a태그를 만들고 다운로드한뒤 갖다 버린다
497
475
let link = document . createElement ( 'a' ) ;
498
476
link . download = "my_image.png" ;
@@ -501,7 +479,7 @@ const GameScreen = forwardRef((props, ref) => {
501
479
link . click ( ) ;
502
480
document . body . removeChild ( link ) ;
503
481
canvasRef5 . current . getContext ( '2d' ) . clearRect ( 0 , 0 , windowSize . width , windowSize . height ) ; // 저장 후 지우기
504
- // canvasRef2.current.focus();
482
+ canvasRef2 . current . focus ( ) ;
505
483
}
506
484
507
485
return (
@@ -547,7 +525,6 @@ const GameScreen = forwardRef((props, ref) => {
547
525
ref = { canvasRef2 }
548
526
mirrored = { true }
549
527
tabIndex = { 0 }
550
- //onKeyDown={f1Down}
551
528
onKeyDown = { spaceDown }
552
529
style = { {
553
530
position : "absolute" ,
0 commit comments