Skip to content

Commit

Permalink
fixing heights, draw function and draw line width
Browse files Browse the repository at this point in the history
  • Loading branch information
imrany committed Oct 16, 2024
1 parent ed7b80e commit c17bf16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export default function App(){
})

window.onresize=function(){
screen.width>1080?setIsSupported(false):setVideoConstraints({height:screen.height, width:screen.width, facingMode:"environment"})
screen.width>1080?setIsSupported(false):setVideoConstraints({height:720, width:screen.width, facingMode:"environment"})
}

useEffect(()=>{
screen.width>1080?setIsSupported(false):setVideoConstraints({height:screen.height, width:screen.width, facingMode:"environment"})
screen.width>1080?setIsSupported(false):setVideoConstraints({height:720, width:screen.width, facingMode:"environment"})
},[screen.width])
return(
<>
Expand Down
1 change: 1 addition & 0 deletions src/components/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const drawRect = (detections:any, ctx:any) =>{

// Set styling
const color = Math.floor(Math.random()*16777215).toString(16);
ctx.lineWidth = 20;
ctx.strokeStyle = '#' + color
ctx.font = '18px Arial';

Expand Down
8 changes: 4 additions & 4 deletions src/pages/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function MainPage() {
// console.log(obj)
// Draw mesh
const ctx = canvasRef.current.getContext("2d");
//ctx.lineWidth = 3
drawRect(obj, ctx);
setObject(obj)
}
Expand Down Expand Up @@ -97,8 +98,7 @@ export default function MainPage() {
right: 0,
textAlign: "center",
zIndex: 9,
height:videoConstraints.height,
width:videoConstraints.width
width:"100vw"
}}
screenshotFormat="image/png"
height={videoConstraints.height}
Expand All @@ -116,9 +116,9 @@ export default function MainPage() {
right: 0,
textAlign: "center",
zIndex: 10,
height:videoConstraints.height,
width:videoConstraints.width
width:"100vw"
}}
width={videoConstraints.width}
/>
<div className="fixed bottom-0 left-0 right-0 z-20 h-[180px]">
<div className="h-fit w-full flex gap-5 flex-col items-center justify-center">
Expand Down

0 comments on commit c17bf16

Please sign in to comment.