Skip to content

Commit

Permalink
Update jellron-display to automatically calculate the correct `widt…
Browse files Browse the repository at this point in the history
…h` with respect to the webcam's aspect ratio
  • Loading branch information
Valkryst committed Dec 5, 2023
1 parent d30e048 commit 1637db1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ table, th, td {
margin: 0 auto;

height: 600px;
width: 800px;

& > canvas, & > video {
position: absolute;
Expand Down
3 changes: 3 additions & 0 deletions js/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export class Camera {
}

this.videoElement.srcObject = await this.getVideoInputDevice();

this.jellronDisplay.style.aspectRatio = `${await this.getMediaStreamWidth() / await this.getMediaStreamHeight()}`;

this.videoElement.height = this.jellronDisplay.scrollHeight;
this.videoElement.width = this.jellronDisplay.scrollWidth;
}
Expand Down

0 comments on commit 1637db1

Please sign in to comment.