Skip to content

Commit

Permalink
Update jellron-display children to use its size
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkryst committed Dec 5, 2023
1 parent 645184c commit 9160996
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ table, th, td {
}

#jellron-display {
margin: 0 auto;

height: 600px;
width: 800px;

& > canvas, & > video {
position: absolute;
}
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
const camera = await new Camera(deviceSelect.value);

const videoElement = await camera.getVideoElement();
keypointRenderer.setSize(videoElement.width, videoElement.height);
videoRenderer.setSize(videoElement.width, videoElement.height);
keypointRenderer.setSize(videoElement.parentElement.scrollWidth, videoElement.parentElement.scrollHeight);
videoRenderer.setSize(videoElement.parentElement.scrollWidth, videoElement.parentElement.scrollHeight);

if (!bodyDetector.isRunning()) {
bodyDetector.start();
Expand Down
4 changes: 2 additions & 2 deletions js/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export class Camera {
* Both FaceDetector and HandDetector use the video element's height and width properties to scale the input
* MediaStream before processing it. This is why we need to set them.
*/
this.videoElement.height = await this.getMediaStreamHeight();
this.videoElement.width = await this.getMediaStreamWidth();
this.videoElement.height = this.videoElement.parentElement.scrollHeight;
this.videoElement.width = this.videoElement.parentElement.scrollWidth;
}

/**
Expand Down

0 comments on commit 9160996

Please sign in to comment.