Skip to content

Commit

Permalink
fix zoom multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
yashrajbharti committed Jun 12, 2024
1 parent 55fc829 commit 288d926
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions assets/line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
<section id="camera">
<video id="stream" muted autoplay playsinline data-lens="none"></video>
<div class="range-container">
<input type="range" name="range" id="range">
<input type="range" name="range" id="range" aria-label="Zoom Level">
<img src="./assets/trackMeter.svg" alt="zoom feature">
<p class="zoom-multiplier"></p>
<img class="slider" src="./assets/line.svg" alt="zoom slider">
<p class="zoom-multiplier" aria-live="polite"></p>
</div>
<div class="switch-camera-video-photo-mode" role="button" tabindex="0">
<input type="radio" id="photo-mode" name="modes" value="photo-mode" checked />
Expand Down
1 change: 1 addition & 0 deletions js/stream.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const streamWebCamVideo = (isFrontCamera = true) => {

input.oninput = function (event) {
track.applyConstraints({ advanced: [{ zoom: event.target.value }] });
document.querySelector(".slider").style.left = "-60px"
}
input.hidden = false;
document.querySelector(".range-container").style.visibility = "visible"
Expand Down
6 changes: 5 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,13 @@ video.flip {
color: #fff;
font-size: 10px;
translate: 0 18px;
pointer-events: none;
}
.range-container img{
position: absolute;
opacity: 0.6;
opacity: 0.9;
pointer-events: none;
}
.range-container .slider{
position: absolute;
}

0 comments on commit 288d926

Please sign in to comment.