Skip to content

Commit

Permalink
added a mask to aim more easily
Browse files Browse the repository at this point in the history
  • Loading branch information
biou authored and clawfire committed Jun 27, 2021
1 parent fa8d136 commit 616c456
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<video id="scanner">
<p>Your browser is not compatible with our technology.</p>
</video>
<div id="mask"></div>
</div>
<div class="content">
<div class="description">
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ window.addEventListener('load', function() {
const flashlight_btn = document.getElementById('flashlight_btn');
// we select the video element, which will provide the user feedback
const video = document.getElementById('scanner');
const mask = document.getElementById('mask');
const width = Math.max($(video).width(), $(video).height())
$(video).width(width)
$(video).height(width)
$(mask).width(width)
$(mask).height(width)

QrScanner.hasCamera().then(hasCamera => {
if (!hasCamera) {
Expand Down
14 changes: 14 additions & 0 deletions src/styles/master.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@ section.ui.fixed.menu + section{
}
video{
width: 100%;
object-fit: cover;
margin-top: 40px;
}

#mask{
position:absolute;
top:40px;
width:100%;
height:100%;
background:rgba(117, 117, 117, 0.8) ;

-webkit-clip-path: polygon(0% 0%, 0% 100%, 25% 100%, 25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 100%, 100% 100%, 100% 0%);
clip-path: polygon(0% 0%, 0% 100%, 25% 100%, 25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 100%, 100% 100%, 100% 0%);

}

1 comment on commit 616c456

@clawfire
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #8

Please sign in to comment.